Commit 56558816 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Cleanup.

parent df0eb066
...@@ -484,6 +484,8 @@ let add fact = ...@@ -484,6 +484,8 @@ let add fact =
(* The length of [fact.word] serves as the priority of this fact. *) (* The length of [fact.word] serves as the priority of this fact. *)
Q.add q fact (W.length fact.word) Q.add q fact (W.length fact.word)
(* ------------------------------------------------------------------------ *)
(* Construct the [star] of every state [s]. Initialize the priority queue. *) (* Construct the [star] of every state [s]. Initialize the priority queue. *)
let () = let () =
...@@ -507,7 +509,9 @@ let () = ...@@ -507,7 +509,9 @@ let () =
foreach_terminal_not_causing_an_error s (fun z -> foreach_terminal_not_causing_an_error s (fun z ->
add { position; word; lookahead = z } add { position; word; lookahead = z }
) )
) );
if X.verbose then
Trie.verbose()
(* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *)
...@@ -908,39 +912,36 @@ let new_fact fact = ...@@ -908,39 +912,36 @@ let new_fact fact =
(* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *)
let level = ref 0 (* The main loop of the algorithm. *)
let extracted, considered = let level, extracted, considered =
ref 0, ref 0 ref 0, ref 0, ref 0
let done_with_level () = let done_with_level () =
Printf.eprintf "Done with level %d.\n" !level;
if X.verbose then begin if X.verbose then begin
Printf.eprintf "Done with level %d.\n" !level;
W.verbose(); W.verbose();
T.verbose(); T.verbose();
E.verbose() E.verbose();
end; Printf.eprintf "Q stores %d facts.\n" (Q.cardinal q);
Printf.eprintf "Q stores %d facts.\n" (Q.cardinal q); Printf.eprintf "%d facts extracted out of Q, of which %d considered.\n%!"
Printf.eprintf "%d facts extracted out of Q, of which %d considered.\n%!" !extracted !considered
!extracted !considered
let discover fact =
incr extracted;
if T.register fact then begin
if W.length fact.word > ! level then begin
done_with_level();
level := W.length fact.word;
end;
incr considered;
new_fact fact
end end
let () = let () =
if X.verbose then Q.repeat q (fun fact ->
Trie.verbose(); incr extracted;
Q.repeat q discover; if T.register fact then begin
Time.tick "Running LRijkstra"; if W.length fact.word > !level then begin
done_with_level() done_with_level();
level := W.length fact.word;
end;
incr considered;
new_fact fact
end
);
done_with_level();
Time.tick "Running LRijkstra"
(* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment