• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1(*===----------------------------------------------------------------------===
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 ()
22