diff options
| author | Joel Martin <github@martintribe.org> | 2015-01-29 21:59:09 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-29 23:40:10 -0600 |
| commit | 0f4ca9d1dea3c9ffbf9472251a524a7509214f7b (patch) | |
| tree | 21f573b22cf4903200f611bd350662c0e1cd059b /template/step2_eval.txt | |
| parent | 899ff7fa98ea4aad5beb837524a8bee8c899df3e (diff) | |
| download | mal-0f4ca9d1dea3c9ffbf9472251a524a7509214f7b.tar.gz mal-0f4ca9d1dea3c9ffbf9472251a524a7509214f7b.zip | |
Draft guide and architecture diagrams.
Diffstat (limited to 'template/step2_eval.txt')
| -rw-r--r-- | template/step2_eval.txt | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/template/step2_eval.txt b/template/step2_eval.txt deleted file mode 100644 index beb5500..0000000 --- a/template/step2_eval.txt +++ /dev/null @@ -1,25 +0,0 @@ ---- step2_eval ---------------------------------- -import types, reader, printer - -READ(str): return reader.read_str(str) - -eval_ast(ast,env): - switch type(ast): - symbol: return lookup(env, ast) OR raise "'" + ast + "' not found" - list,vector: return ast.map((x) -> EVAL(x,env)) - hash: return ast.map((k,v) -> list(k, EVAL(v,env))) - _default_: return ast - -EVAL(ast,env): - if not list?(ast): return eval_ast(ast, env) - f, args = eval_ast(ast, env) - return apply(f, args) - -PRINT(exp): return printer.pr_str(exp) - -repl_env = {'+: add_fn, ...} -rep(str): return PRINT(EVAL(READ(str),repl_env)) - -main loop: - try: println(rep(readline("user> "))) - catch e: println("Error: ", e) |
