aboutsummaryrefslogtreecommitdiff
path: root/ocaml/step1_read_print.ml
blob: 1735e119743a663002bc1b193599166ac4b449ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let read str = Reader.read_str str
let eval ast any = ast
let print exp = Printer.pr_str exp true
let rep str = print (eval (read str) "")

let rec main =
  try
    while true do
      print_string "user> ";
      let line = read_line () in
        try
          print_endline (rep line);
        with End_of_file -> ()
    done
  with End_of_file -> ()