mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 21:57:38 +03:00
- Reorder README to have implementation list after "learning tool" bullet. - This also moves tests/ and libs/ into impls. It would be preferrable to have these directories at the top level. However, this causes difficulties with the wasm implementations which need pre-open directories and have trouble with paths starting with "../../". So in lieu of that, symlink those directories to the top-level. - Move the run_argv_test.sh script into the tests directory for general hygiene.
43 lines
721 B
Plaintext
43 lines
721 B
Plaintext
include "reader";
|
|
include "printer";
|
|
include "utils";
|
|
|
|
def read_line:
|
|
. as $in
|
|
| label $top
|
|
| _readline;
|
|
|
|
def READ:
|
|
read_str | read_form | .value;
|
|
|
|
def EVAL:
|
|
.;
|
|
|
|
def PRINT:
|
|
pr_str;
|
|
|
|
def rep:
|
|
READ | EVAL |
|
|
if . != null then
|
|
PRINT
|
|
else
|
|
null
|
|
end;
|
|
|
|
def repl_:
|
|
("user> " | _print) |
|
|
(read_line | rep);
|
|
|
|
def repl:
|
|
{continue: true} | while(
|
|
.continue;
|
|
try {value: repl_, continue: true}
|
|
catch
|
|
if is_jqmal_error then
|
|
{value: "Error: \(.)", continue: true}
|
|
else
|
|
{value: ., continue: false}
|
|
end) | if .value then .value|_display else empty end;
|
|
|
|
repl
|