Common Lisp: Add documentation
[jackhill/mal.git] / logo / step1_read_print.lg
1 load "../logo/readline.lg
2 load "../logo/reader.lg
3 load "../logo/printer.lg
4
5 to _read :str
6 output read_str :str
7 end
8
9 to _eval :ast :env
10 output :ast
11 end
12
13 to _print :exp
14 output pr_str :exp "true
15 end
16
17 to rep :str
18 output _print _eval _read :str []
19 end
20
21 to repl
22 localmake "running "true
23 while [:running] [
24 localmake "line readline word "user> :space_char
25 ifelse :line=[] [
26 print "
27 make "running "false
28 ] [
29 if not emptyp :line [
30 catch "error [print rep :line]
31 localmake "exception error
32 if not emptyp :exception [
33 (print "Error: first butfirst :exception)
34 ]
35 ]
36 ]
37 ]
38 end
39
40 repl
41 bye