Source

OCamlRuby / main.ml

Full commit
open Util
open Lexer
open ParserUtil
open Parser

let main =
  let ch = open_in Sys.argv.(1) in
  let tstream = Lexer.lexer (Stream.of_channel ch) in
  let rec read_iter store =
    try read_iter (Stream.next tstream :: store) with
    | Stream.Failure -> List.rev store
    | Stream.Error msg -> p "stream error: %s\n" msg; List.rev store
  in
  let ast = Parser.parse (read_iter []) in
(*  print_endline @@ Expression.sexpr ast;*)
  Eval.eval Eval.init_ctx ast