aboutsummaryrefslogtreecommitdiff
path: root/ocaml/step0_repl.ml
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-01-30 12:06:45 -0600
committerJoel Martin <github@martintribe.org>2015-01-30 12:06:45 -0600
commit644e5ff95e186094054221cf2f13048630f81fa0 (patch)
tree14f965eee633f4ea185f640c6130e54063056d6b /ocaml/step0_repl.ml
parentbf518367d0706b2fa727acc5326230ef8d3c812b (diff)
parentbc6448bce925d18ecb893e8e8ee10d2b2178b31a (diff)
downloadmal-644e5ff95e186094054221cf2f13048630f81fa0.tar.gz
mal-644e5ff95e186094054221cf2f13048630f81fa0.zip
Merge pull request #3 from Chouser/ocaml
Ocaml
Diffstat (limited to 'ocaml/step0_repl.ml')
-rw-r--r--ocaml/step0_repl.ml23
1 files changed, 23 insertions, 0 deletions
diff --git a/ocaml/step0_repl.ml b/ocaml/step0_repl.ml
new file mode 100644
index 0000000..e3478f7
--- /dev/null
+++ b/ocaml/step0_repl.ml
@@ -0,0 +1,23 @@
+(*
+ To try things at the ocaml repl:
+ rlwrap ocaml
+
+ To see type signatures of all functions:
+ ocamlc -i step0_repl.ml
+
+ To run the program:
+ ocaml step0_repl.ml
+*)
+
+let read str = str
+let eval ast any = ast
+let print exp = exp
+let rep str = print (eval (read str) "")
+
+let rec main =
+ try
+ while true do
+ print_string "user> ";
+ print_endline (rep (read_line ()));
+ done
+ with End_of_file -> ()