diff options
| author | Joel Martin <github@martintribe.org> | 2014-11-08 16:56:36 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-09 16:16:45 -0600 |
| commit | 891c3f3b478292ad0bfca44b0dc098a2aecc9a5d (patch) | |
| tree | d30c7923ffee7699cfca94af84f3be297448fff2 /coffee/step0_repl.coffee | |
| parent | 9b3362e86a57ed7f14c5fd018c37713185e0c154 (diff) | |
| download | mal-891c3f3b478292ad0bfca44b0dc098a2aecc9a5d.tar.gz mal-891c3f3b478292ad0bfca44b0dc098a2aecc9a5d.zip | |
CoffeeScript: add all steps. Self-hosting.
Diffstat (limited to 'coffee/step0_repl.coffee')
| -rw-r--r-- | coffee/step0_repl.coffee | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/coffee/step0_repl.coffee b/coffee/step0_repl.coffee new file mode 100644 index 0000000..4fa9e40 --- /dev/null +++ b/coffee/step0_repl.coffee @@ -0,0 +1,20 @@ +readline = require "./node_readline.coffee" + +# read +READ = (str) -> str + +# eval +EVAL = (ast, env) -> ast + +# print +PRINT = (exp) -> exp + +# repl +rep = (str) -> PRINT(EVAL(READ(str), {})) + +# repl loop +while (line = readline.readline("user> ")) != null + continue if line == "" + console.log rep line + +# vim: ts=2:sw=2 |
