Fixed some bugs.
[llvm/zpu.git] / examples / OCaml-Kaleidoscope / Chapter3 / toy.ml
blob73c1a1ec62a28865b0240e78b367f76b07a79181
1 (*===----------------------------------------------------------------------===
2 * Main driver code.
3 *===----------------------------------------------------------------------===*)
5 open Llvm
7 let main () =
8 (* Install standard binary operators.
9 * 1 is the lowest precedence. *)
10 Hashtbl.add Parser.binop_precedence '<' 10;
11 Hashtbl.add Parser.binop_precedence '+' 20;
12 Hashtbl.add Parser.binop_precedence '-' 20;
13 Hashtbl.add Parser.binop_precedence '*' 40; (* highest. *)
15 (* Prime the first token. *)
16 print_string "ready> "; flush stdout;
17 let stream = Lexer.lex (Stream.of_channel stdin) in
19 (* Run the main "interpreter loop" now. *)
20 Toplevel.main_loop stream;
22 (* Print out all the generated code. *)
23 dump_module Codegen.the_module
26 main ()