- printf "pretty printing took %f seconds\n" (time4 -. time3);
- dump_xml t' id_to_uri "out.xml";
- print_endline (CicNotationPp.pp_term t'); flush stdout
- )
-(* CicNotationParser.print_l2_pattern ()) *)
- | 1 -> ignore (CicNotationParser.parse_syntax_pattern istream)
- | 2 ->
- let ast = CicNotationParser.parse_ast_pattern istream in
- if ast = P.Sort `Prop then
- prerr_endline "eureka"
- else
- prerr_endline ":-("
- | 3 -> ignore (CicNotationParser.parse_interpretation istream)
- | _ -> Arg.usage arg_spec usage; exit 1);
- with CicNotationParser.Parse_error (floc, msg) ->
- let (x, y) = P.loc_of_floc floc in
- let before = String.sub line 0 x in
- let error = String.sub line x (y - x) in
- let after = String.sub line y (String.length line - y) in
- eprintf "%s\e[01;31m%s\e[00m%s\n" before error after;
- prerr_endline (sprintf "at character %d-%d: %s" x y msg)
- done
- with End_of_file ->
- close_in ic
+ prerr_endline (sprintf "pretty printing took %f seconds\n"
+ (time4 -. time3));
+ prerr_endline (CicNotationPp.pp_term t');
+ dump_xml t' id_to_uri "out.xml"
+ | _ ->
+ prerr_endline "Unsupported statement"
+ with
+ | End_of_file -> raise End_of_file
+ | CicNotationParser.Parse_error (floc, msg) ->
+ let (x, y) = P.loc_of_floc floc in
+(* let before = String.sub line 0 x in
+ let error = String.sub line x (y - x) in
+ let after = String.sub line y (String.length line - y) in
+ eprintf "%s\e[01;31m%s\e[00m%s\n" before error after;
+ prerr_endline (sprintf "at character %d-%d: %s" x y msg) *)
+ prerr_endline (sprintf "Parse error at character %d-%d: %s"
+ (!char_count + x) (!char_count + y) msg);
+ errquit ignore_exn
+ | exn ->
+ prerr_endline
+ (sprintf "Uncaught exception: %s" (Printexc.to_string exn));
+ errquit ignore_exn
+ done
+ with End_of_file ->
+ ()
+
+let _ =
+ let arg_spec = [ ] in
+ let usage = "" in
+ Arg.parse arg_spec (fun _ -> raise (Arg.Bad usage)) usage;
+ print_endline "Loading builtin notation ...";
+ let ic = open_in (Helm_registry.get "notation.core_file") in
+ process_stream ~ignore_exn:true (Stream.of_channel ic);
+ close_in ic;
+ print_endline "done.";
+ flush stdout;
+ process_stream ~ignore_exn:false (Stream.of_channel stdin)