Add missing clean targets in 5 impls.
[jackhill/mal.git] / ps / step0_repl.ps
1 % read
2 /_readline { print flush (%stdin) (r) file 1024 string readline } def
3
4 /READ {
5 % just "return" the input string
6 /str exch def
7 str
8 } def
9
10
11 % eval
12 /EVAL {
13 % just "return" the "ast"
14 /env exch def
15 /ast exch def
16 ast
17 } def
18
19
20 % print
21 /PRINT {
22 % just "return" the expression
23 /exp exch def
24 exp
25 } def
26
27
28 % repl
29 /REP { READ (stub env) EVAL PRINT } def
30
31 % repl loop
32 { %loop
33 (user> ) _readline
34 not { exit } if % exit if EOF
35
36 REP print (\n) print
37 } bind loop
38
39 (\n) print % final newline before exit for cleanliness
40 quit