Update README.md and TODO. Minor PS update.
[jackhill/mal.git] / ps / step0_repl.ps
1 % read
2 /READ {
3 % just "return" the input string
4 /str exch def
5 str
6 } def
7
8
9 % eval
10 /EVAL {
11 % just "return" the "ast"
12 /env exch def
13 /ast exch def
14 ast
15 } def
16
17
18 % print
19 /PRINT {
20 % just "return" the expression
21 /exp exch def
22 exp
23 } def
24
25
26 % repl
27 /REP {
28 READ (stub env) EVAL PRINT
29 } def
30
31 /stdin (%stdin) (r) file def
32
33 { % loop
34 (user> ) print flush
35
36 %(%lineedit) (r) file 99 string readline
37 stdin 99 string readline
38
39 not { exit } if % exit if EOF
40
41 %(\ngot line: ) print dup print (\n) print flush
42 REP print (\n) print
43 } bind loop
44
45 (\n) print % final newline before exit for cleanliness
46 quit