1 (*===----------------------------------------------------------------------=== 2 * Main driver code. 3 *===----------------------------------------------------------------------===*) 4 5 open Llvm 6 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. *) 14 15 (* Prime the first token. *) 16 print_string "ready> "; flush stdout; 17 let stream = Lexer.lex (Stream.of_channel stdin) in 18 19 (* Run the main "interpreter loop" now. *) 20 Toplevel.main_loop stream; 21 22 (* Print out all the generated code. *) 23 dump_module Codegen.the_module 24 ;; 25 26 main () 27