blob: 42b19fec00191c86aea80c6c6f6d4d6d917bf118 [file] [log] [blame]
Erick Tryzelaarf1197652010-03-08 19:32:27 +00001(*===----------------------------------------------------------------------===
2 * Main driver code.
3 *===----------------------------------------------------------------------===*)
4
5let main () =
6 (* Install standard binary operators.
7 * 1 is the lowest precedence. *)
8 Hashtbl.add Parser.binop_precedence '<' 10;
9 Hashtbl.add Parser.binop_precedence '+' 20;
10 Hashtbl.add Parser.binop_precedence '-' 20;
11 Hashtbl.add Parser.binop_precedence '*' 40; (* highest. *)
12
13 (* Prime the first token. *)
14 print_string "ready> "; flush stdout;
15 let stream = Lexer.lex (Stream.of_channel stdin) in
16
17 (* Run the main "interpreter loop" now. *)
18 Toplevel.main_loop stream;
19;;
20
21main ()