diff options
| author | Joel Martin <github@martintribe.org> | 2014-03-29 17:35:53 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-03-29 17:35:53 -0500 |
| commit | aef93ea3969feee92e68358395d5750ebe83f57d (patch) | |
| tree | 9e38fae1432ac26f2c4915f3f38d8ae6ccfe54f8 /ps/step2_eval.ps | |
| parent | 04517bc8265b6930e96735dd5d12b7aac7d86217 (diff) | |
| download | mal-aef93ea3969feee92e68358395d5750ebe83f57d.tar.gz mal-aef93ea3969feee92e68358395d5750ebe83f57d.zip | |
PS: error handling, throw, print excpetions without dying.
Diffstat (limited to 'ps/step2_eval.ps')
| -rw-r--r-- | ps/step2_eval.ps | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/ps/step2_eval.ps b/ps/step2_eval.ps index 72a91fa..dec403c 100644 --- a/ps/step2_eval.ps +++ b/ps/step2_eval.ps @@ -14,7 +14,12 @@ /ast exch def %(eval_ast: ) print ast == /nametype ast type eq { %if symbol - env ast get + env ast known { + env ast get + }{ + (') ast pr_str (' not found) + concatenate concatenate throw + } ifelse }{ /arraytype ast type eq { %elseif list [ ast { @@ -44,9 +49,7 @@ end } def % print /PRINT { - /exp exch def - %(printing: ) print exp == - exp pr_str + pr_str } def @@ -71,7 +74,13 @@ end } def not { exit } if % exit if EOF %(\ngot line: ) print dup print (\n) print flush - REP print (\n) print + { %try + REP print (\n) print + } stopped { + (Error: ) print + get_error_data pr_str print (\n) print + clear + } if } bind loop (\n) print % final newline before exit for cleanliness |
