Julia: step0
authorJoel Martin <github@martintribe.org>
Sat, 28 Mar 2015 20:10:32 +0000 (15:10 -0500)
committerJoel Martin <github@martintribe.org>
Wed, 1 Apr 2015 04:04:42 +0000 (23:04 -0500)
julia/step0_repl.jl [new file with mode: 0755]

diff --git a/julia/step0_repl.jl b/julia/step0_repl.jl
new file mode 100755 (executable)
index 0000000..7e61105
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/env julia
+
+# READ
+function READ(str)
+    str
+end
+
+# EVAL
+function EVAL(ast, env)
+    ast
+end
+
+# PRINT
+function PRINT(exp)
+    exp
+end
+
+# REPL
+function REP(str)
+    return PRINT(EVAL(READ(str), {}))
+end
+
+while true
+    print("user> ")
+    flush(STDOUT)
+    line = readline(STDIN)
+    if line == ""
+        break
+    end
+    line = chomp(line)
+    println(REP(line))
+end