(types.ps) run (reader.ps) run % read /READ { /str exch def str read_str } def % eval /EVAL { 2 dict begin % just "return" the "ast" /env exch def /ast exch def ast end } def % print /PRINT { true _pr_str } def % repl /REP { READ (stub env) EVAL PRINT } def /stdin (%stdin) (r) file def { % loop (user> ) print flush stdin 99 string readline not { exit } if % exit if EOF %(\ngot line: ) print dup print (\n) print flush { %try REP print (\n) print } stopped { (Error: ) print get_error_data false _pr_str print (\n) print clear } if } bind loop (\n) print % final newline before exit for cleanliness quit