Commit | Line | Data |
---|---|---|
a870ad3f VS |
1 | (de load-relative (Path) |
2 | (load (pack (car (file)) Path)) ) | |
3 | ||
4 | (load-relative "readline.l") | |
5 | (load-relative "types.l") | |
6 | (load-relative "reader.l") | |
7 | (load-relative "printer.l") | |
8 | ||
9 | (de READ (String) | |
10 | (read-str String) ) | |
11 | ||
12 | (de EVAL (Ast) | |
13 | Ast) | |
14 | ||
15 | (de PRINT (Ast) | |
16 | (pr-str Ast T) ) | |
17 | ||
18 | (de rep (String) | |
19 | (PRINT (EVAL (READ String))) ) | |
20 | ||
21 | (load-history ".mal_history") | |
22 | ||
23 | (use Eof | |
24 | (until Eof | |
25 | (let Input (readline "user> ") | |
26 | (if (=0 Input) | |
27 | (setq Eof T) | |
28 | (let Output (catch 'err (rep Input)) | |
29 | (if (isa '+MALError Output) | |
8d229b7c | 30 | (let Message (MAL-value Output) |
1809f9ba VS |
31 | (unless (= (MAL-value Message) "end of token stream") |
32 | (prinl "[error] " (pr-str Message)) ) ) | |
a870ad3f VS |
33 | (prinl Output) ) ) ) ) ) ) |
34 | ||
35 | (prinl) | |
36 | (bye) |