3 push!(LOAD_PATH, pwd(), "/usr/share/julia/base")
15 function eval_ast(ast, env)
16 if typeof(ast) == Symbol
18 elseif isa(ast, Array) || isa(ast, Tuple)
19 map((x) -> EVAL(x,env), ast)
21 [EVAL(x[1],env) => EVAL(x[2], env) for x=ast]
27 function EVAL(ast, env)
28 if !isa(ast, Array) return eval_ast(ast, env) end
29 if isempty(ast) return ast end
33 env_set(env, ast[2], EVAL(ast[3], env))
34 elseif symbol("let*") == ast[1]
36 for i = 1:2:length(ast[2])
37 env_set(let_env, ast[2][i], EVAL(ast[2][i+1], let_env))
41 el = eval_ast(ast, env)
42 f, args = el[1], el[2:end]
53 repl_env = Env(nothing,
54 Dict{Any,Any}(:+ => +,
59 return PRINT(EVAL(READ(str), repl_env))
63 line = readline_mod.do_readline("user> ")
64 if line === nothing break end
68 if isa(e, ErrorException)
69 println("Error: $(e.msg)")
71 println("Error: $(string(e))")
73 bt = catch_backtrace()
74 Base.show_backtrace(STDERR, bt)