From ca51c4f77235d8f9b8606ebc8c255778c83c9050 Mon Sep 17 00:00:00 2001 From: Chouser Date: Wed, 21 Jan 2015 20:53:51 -0500 Subject: OCaml: add step 0 --- ocaml/step0_repl.ml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ocaml/step0_repl.ml (limited to 'ocaml/step0_repl.ml') 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 -> () -- cgit v1.2.3