Commit | Line | Data |
---|---|---|
b3c30da9 JM |
1 | ;; read |
2 | (def! READ (fn* [strng] | |
3 | strng)) | |
4 | ||
5 | ;; eval | |
6 | (def! EVAL (fn* [ast env] | |
7 | ast)) | |
8 | ||
9 | ||
10 | (def! PRINT (fn* [exp] exp)) | |
11 | ||
12 | ;; repl | |
13 | (def! rep (fn* [strng] | |
14 | (PRINT (EVAL (READ strng) {})))) | |
15 | ||
16 | ;; repl loop | |
17 | (def! repl-loop (fn* [] | |
18 | (let* [line (readline "mal-user> ")] | |
19 | (if line | |
20 | (do | |
21 | (if (not (= "" line)) | |
22 | (try* | |
23 | (println (rep line)) | |
24 | (catch* exc | |
25 | (println "Uncaught exception:" exc)))) | |
26 | (repl-loop)))))) | |
27 | ||
28 | (def! -main (fn* [& args] | |
29 | (repl-loop))) | |
30 | (-main) |