- ac = AO.initial_counters;
- mc = MO.initial_counters;
- brgc = BO.initial_counters;
- bagc = ZO.initial_counters;
- mst = MA.initial_status ();
- dst = AD.initial_status ();
- tst = TD.initial_status ();
- ast = AA.initial_status ();
- kst = E.initial_status ()
+ kst = S.initial_status ();
+ tst = TD.initial_status ();
+ pst = AA.initial_status ();
+ ast = AD.initial_status ();
+ ac = AO.initial_counters;
+ dc = DO.initial_counters;
+ bc = BO.initial_counters;
+ zc = ZO.initial_counters;
+ mst = MA.initial_status ();
+ mc = MO.initial_counters;
type kernel_entity = BrgEntity of Brg.entity
| BagEntity of Bag.entity
| CrgEntity of Crg.entity
| MetaEntity of Meta.entity
type kernel_entity = BrgEntity of Brg.entity
| BagEntity of Bag.entity
| CrgEntity of Crg.entity
| MetaEntity of Meta.entity
-let print_counters st = match !kernel with
- | Brg -> BO.print_counters C.start st.brgc
- | Bag -> ZO.print_counters C.start st.bagc
-
-let xlate_entity entity = match !kernel, entity with
- | Brg, CrgEntity e ->
+let xlate_entity entity = match !G.kernel, entity with
+ | G.Brg, CrgEntity e ->
- | CrgEntity e -> E.common f e
- | BrgEntity e -> E.common f e
- | BagEntity e -> E.common f e
+ | CrgEntity e -> E.common f e
+ | BrgEntity e -> E.common f e
+ | BagEntity e -> E.common f e
- | BrgEntity e -> {st with brgc = BO.count_entity C.start st.brgc e}
- | BagEntity e -> {st with bagc = ZO.count_entity C.start st.bagc e}
- | _ -> st
-
-let export_entity si xdir moch = function
- | CrgEntity e -> XL.export_entity XD.export_term si xdir e
- | BrgEntity e -> XL.export_entity BO.export_term si xdir e
- | MetaEntity e ->
- begin match moch with
- | None -> ()
- | Some och -> ML.write_entity C.start och e
- end
+
+let export_entity = function
+ | CrgEntity e -> XL.export_entity XD.export_term e
+ | BrgEntity e -> XL.export_entity BO.export_term e
+ | MetaEntity _
let old = ref false
let st = ref (initial_status ())
let streaming = ref false (* parsing style (temporary) *)
let process_2 st entity =
let st = if !L.level > 2 then count_entity st entity else st in
let old = ref false
let st = ref (initial_status ())
let streaming = ref false (* parsing style (temporary) *)
let process_2 st entity =
let st = if !L.level > 2 then count_entity st entity else st in
if !stage > 2 then type_check st entity else st
let process_1 st entity =
if !progress then pp_progress entity;
let st = if !L.level > 2 then count_entity st entity else st in
if !stage > 2 then type_check st entity else st
let process_1 st entity =
if !progress then pp_progress entity;
let st = if !L.level > 2 then count_entity st entity else st in
- let err dst = {st with dst = dst} in
- let g dst e = process_1 {st with dst = dst} (CrgEntity e) in
- AD.crg_of_aut err g st.dst e
+ let err ast = {st with ast = ast} in
+ let g ast e = process_1 {st with ast = ast} (CrgEntity e) in
+ AD.crg_of_aut err g st.ast e
if !preprocess then process_input f st entity else f st entity
let process_nostreaming st lexbuf input =
if !preprocess then process_input f st entity else f st entity
let process_nostreaming st lexbuf input =
-let rec process_streaming st lexbuf input = match entity_of_input lexbuf input with
- | NoEntity -> st
- | e -> process_streaming (process_0 st e) lexbuf input
+let process_streaming st lexbuf input =
+ let rec aux st = match entity_of_input lexbuf input with
+ | NoEntity -> st
+ | e -> aux (process_0 st e)
+ in
+ aux st
let ich = open_in name in
let lexbuf = Lexing.from_channel ich in
let st = process st lexbuf input in
let ich = open_in name in
let lexbuf = Lexing.from_channel ich in
let st = process st lexbuf input in
let print_version () = L.warn (version_string ^ "\n"); exit 0 in
let set_hierarchy s =
if H.set_graph s then () else
L.warn (P.sprintf "Unknown type hierarchy: %s" s)
in
let set_kernel = function
let print_version () = L.warn (version_string ^ "\n"); exit 0 in
let set_hierarchy s =
if H.set_graph s then () else
L.warn (P.sprintf "Unknown type hierarchy: %s" s)
in
let set_kernel = function
| s -> L.warn (P.sprintf "Unknown kernel version: %s" s)
in
let set_summary i = L.level := i in
let set_stage i = stage := i in
| s -> L.warn (P.sprintf "Unknown kernel version: %s" s)
in
let set_summary i = L.level := i in
let set_stage i = stage := i in
- stage := 3; moch := None; meta := false; progress := false;
- preprocess := false; root := ""; cc := false; export := "";
- old := false; kernel := Brg; st := initial_status ();
+ progress := false; old := false; export := false; preprocess := false;
+ stage := 3; root := "";
+ st := initial_status ();
L.warn (P.sprintf "Processing file: %s" name);
if !L.level > 0 then Y.utime_stamp "started";
let base_name = Filename.chop_extension (Filename.basename name) in
L.warn (P.sprintf "Processing file: %s" name);
if !L.level > 0 then Y.utime_stamp "started";
let base_name = Filename.chop_extension (Filename.basename name) in
let sst, input = process (refresh_status !st) name in
st := sst;
if !L.level > 0 then Y.utime_stamp "processed";
if !L.level > 2 then begin
AO.print_counters C.start !st.ac;
let sst, input = process (refresh_status !st) name in
st := sst;
if !L.level > 0 then Y.utime_stamp "processed";
if !L.level > 2 then begin
AO.print_counters C.start !st.ac;
- if !preprocess then AO.print_process_counters C.start !st.ast;
- if !stage > 0 then MO.print_counters C.start !st.mc;
- if !stage > 1 then print_counters !st;
+ if !preprocess then AO.print_process_counters C.start !st.pst;
+ if !stage > 0 then
+ if !old then MO.print_counters C.start !st.mc
+ else print_counters !st G.Crg;
+ if !stage > 1 then print_counters !st !G.kernel;
"Summary levels: 0 just errors (default), 1 time stamps, 2 processed file names, \
3 data information, 4 typing information, 5 reduction information\n\n" ^
"Stages: 0 parsing, 1 to intermediate, 2 to untrusted, 3 to trusted (default)\n"
in
let help_L = " show lexer debug information" in
"Summary levels: 0 just errors (default), 1 time stamps, 2 processed file names, \
3 data information, 4 typing information, 5 reduction information\n\n" ^
"Stages: 0 parsing, 1 to intermediate, 2 to untrusted, 3 to trusted (default)\n"
in
let help_L = " show lexer debug information" in
let help_P = " show parser debug information" in
let help_S = "<number> set summary level (see above)" in
let help_V = " show version information" in
let help_X = " clear options" in
let help_P = " show parser debug information" in
let help_S = "<number> set summary level (see above)" in
let help_V = " show version information" in
let help_X = " clear options" in
let help_i = " show local references by index" in
let help_j = " show URI of processed kernel objects" in
let help_i = " show local references by index" in
let help_j = " show URI of processed kernel objects" in
let help_o = " use old abstract language instead of crg" in
let help_p = " preprocess source" in
let help_q = " disable quotation of identifiers" in
let help_o = " use old abstract language instead of crg" in
let help_p = " preprocess source" in
let help_q = " disable quotation of identifiers" in
let help_s = "<number> set translation stage (see above)" in
let help_u = " activate sort inclusion" in
let help_s = "<number> set translation stage (see above)" in
let help_u = " activate sort inclusion" in
let help_1 = " parse files with streaming policy" in
L.box 0; L.box_err ();
at_exit exit;
Arg.parse [
("-L", Arg.Set G.debug_lexer, help_L);
let help_1 = " parse files with streaming policy" in
L.box 0; L.box_err ();
at_exit exit;
Arg.parse [
("-L", Arg.Set G.debug_lexer, help_L);
("-P", Arg.Set G.debug_parser, help_P);
("-S", Arg.Int set_summary, help_S);
("-V", Arg.Unit print_version, help_V);
("-X", Arg.Unit clear_options, help_X);
("-P", Arg.Set G.debug_parser, help_P);
("-S", Arg.Int set_summary, help_S);
("-V", Arg.Unit print_version, help_V);
("-X", Arg.Unit clear_options, help_X);
("-g", Arg.Set G.expand, help_g);
("-h", Arg.String set_hierarchy, help_h);
("-i", Arg.Set G.indexes, help_i);
("-j", Arg.Set progress, help_j);
("-k", Arg.String set_kernel, help_k);
("-g", Arg.Set G.expand, help_g);
("-h", Arg.String set_hierarchy, help_h);
("-i", Arg.Set G.indexes, help_i);
("-j", Arg.Set progress, help_j);
("-k", Arg.String set_kernel, help_k);
("-o", Arg.Set old, help_o);
("-p", Arg.Set preprocess, help_p);
("-q", Arg.Set G.unquote, help_q);
("-r", Arg.String set_root, help_r);
("-s", Arg.Int set_stage, help_s);
("-u", Arg.Set G.si, help_u);
("-o", Arg.Set old, help_o);
("-p", Arg.Set preprocess, help_p);
("-q", Arg.Set G.unquote, help_q);
("-r", Arg.String set_root, help_r);
("-s", Arg.Int set_stage, help_s);
("-u", Arg.Set G.si, help_u);
("-1", Arg.Set streaming, help_1);
] process_file help;
with ZT.TypeError msg -> bag_error "Type Error" msg
("-1", Arg.Set streaming, help_1);
] process_file help;
with ZT.TypeError msg -> bag_error "Type Error" msg