12 /eval_ast
{ 2 dict begin
15 %(eval_ast: ) print ast ==
16 /nametype ast type eq
{ %if symbol
20 (') ast pr_str (' not found
)
21 concatenate concatenate throw
23 }{ /arraytype ast type eq
{ %elseif list
37 %(EVAL: ) print ast ==
38 /arraytype ast type ne
{ %if not a list
40 }{ %else apply the list
41 /el ast env eval_ast def
44 %(vvv\n) print pstack (^^^\n) print
45 exec % apply function to args
58 (+) { dup 0 get
exch 1 get add
}
59 (-) { dup 0 get
exch 1 get
sub }
60 (*) { dup 0 get
exch 1 get
mul }
61 (/) { dup 0 get
exch 1 get
idiv }
64 /REP
{ READ repl_env EVAL PRINT
} def
66 /stdin
(%stdin) (r) file def
71 %(%lineedit) (r) file 99 string readline
72 stdin
99 string readline
74 not
{ exit } if % exit if EOF
76 %(\ngot line: ) print dup print (\n) print flush
82 get_error_data
false _pr_str print
(\n) print
87 (\n) print
% final newline before exit for cleanliness