X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fmain.ml;fp=src%2Fmain.ml;h=b36427552a3bdb893644458aa9ecfa510cbb3906;hb=0578813dc7114276daf382d47661f027c973eb35;hp=cb7585fde630437be962feae588e1560c0b0a6b4;hpb=6df6ad6cf27e57872bd5891b49354acb0a5ce6a4;p=SXSI%2Fxpathcomp.git diff --git a/src/main.ml b/src/main.ml index cb7585f..b364275 100644 --- a/src/main.ml +++ b/src/main.ml @@ -94,8 +94,30 @@ let document = if Filename.check_suffix !Options.input_file ".g.bin" then let g = time ~msg:"Loading grammar" (Grammar.load !Options.input_file) true in begin - ignore(g); - Unix.sleep 10; (* Leave monitoring process the time to read the HWM *) + (* Todo Factorise with main *) + Tag.init (Grammar.tag_operations g); + let query = + time ~msg:"Parsing query" XPath.parse !Options.query + in + if !Options.verbose then begin + Printf.eprintf "Parsed query:\n%!"; + XPath.Ast.print Format.err_formatter query; + Format.fprintf Format.err_formatter "\n%!" + end; + let auto, bu_info = + time ~msg:"Compiling query" (Compile.compile) query + in + if !Options.verbose then Ata.print Format.err_formatter auto; + Gc.full_major(); + Gc.compact(); + Gc.set (tuned_gc); + let runtime = + let module R = ResJIT.Count in + let module M = Runtime.Make(R) in + (* mk_runtime run auto doc arg count print outfile *) + mk_runtime M.grammar_run auto (Obj.magic g) () R.NS.length (Obj.magic R.NS.serialize) None + in + runtime (); exit 0 end else if Filename.check_suffix !Options.input_file ".srx"