module StringMap = Map.Make(String)

(* Output File *)
let file = "output.c"

let _ =
  let lexbuf = Lexing.from_channel stdin in
  let program = Parser.program Scanner.token lexbuf in
(*  let listing = Ast.string_of_program program in *)
  let typeCheck = Sast.check program in
  let code = Compile.translate_program program in
  let oc = open_out file in
    let typeCheckResult = match typeCheck with
       Some true -> "Type Checked okay"
     | Some false -> "Type checked false"
     | None -> "Type check failed"
    in
      print_string typeCheckResult;
(*      print_string (listing ^ code); *)
      Printf.fprintf oc "%s\n" code;
      close_out oc
  
