let eval_trans auto s1 s2 trans =
- LOG("top-down-run", 2, __ "Evaluating transition list:\n%!");
- LOG("top-down-run", 2, __ "%a\n%!" Translist.print trans);
+ LOG(__ "top-down-run" 3 "Evaluating transition list:@\n%a" Translist.print trans);
Translist.fold
(fun t ((a_st, a_op, a_todo) as acc)->
let q, _, m, f = Transition.node t in
else sl1
else sl2
in
- eprintf "Here 1\n%!";
U.exec sl sl1 sl2 node code;
res, sl
end
else sl1
else sl2
in
- eprintf "Here 2\n%!";
U.exec sl sl1 sl2 node code;
res, sl
end
let cache_apply cache auto tlist s1 s2 =
let f = gen_code auto tlist s1 s2 in
- LOG("grammar", 2, __ "Inserting: %i, %a, %a\n%!"
+ LOG(__ "grammar" 2 "Inserting: %i, %a, %a\n%!"
(Uid.to_int tlist.Translist.Node.id) StateSet.print s1 StateSet.print s2);
add cache tlist s1 s2 f; f
end
DEFINE LOOP (t, states, ctx) = (
let _t = t in
- LOG("top-down-run", 3,
- __ "Entering node %i with loop (tag %s, context %i) with states %a\n%!"
- (Node.to_int _t)
- (Tag.to_string (Tree.tag tree _t))
- (Node.to_int (ctx))
- (StateSet.print) (states));
+ LOG(__ "top-down-run" 3
+ "Entering node %i with loop (tag %s, context %i) with states %a"
+ (Node.to_int _t)
+ (Tag.to_string (Tree.tag tree _t))
+ (Node.to_int (ctx))
+ (StateSet.print) (states));
if _t == Tree.nil then nil_res
else
let tag = Tree.tag tree _t in
DEFINE LOOP_TAG (t, states, tag, ctx) = (
let _t = (t) in (* to avoid duplicating expression t *)
- LOG("top-down-run", 3,
- __ "Entering node %i with loop_tag (tag %s, context %i) with states %a\n%!"
+ LOG(__ "top-down-run" 3
+ "Entering node %i with loop_tag (tag %s, context %i) with states %a"
(Node.to_int _t)
(Tag.to_string (tag))
(Node.to_int (ctx))
match opcode with
| L2JIT.RETURN -> nil_res
| L2JIT.CACHE ->
- LOG("top-down-run", 3,
- __ "Top-down cache miss for configuration %s %a\n%!"
+ LOG(__ "top-down-run" 3
+ "Top-down cache miss for configuration %s %a"
(Tag.to_string tag) StateSet.print states);
let opcode = L2JIT.compile cache2 auto tree tag states in
l2jit_dispatch t tag states ctx opcode
in
let lambda = ref 0 in
let rec start_loop idx states =
- LOG("grammar", 2, __ "Node %i\n%!" (Node.to_int idx));
+ LOG(__ "grammar" 2 "Node %i\n%!" (Node.to_int idx));
if states == dummy_set then nil_res else
if idx < Node.null then nil_res
else begin
let set a i v =
- LOG("twopass", 2, __ "Setting node %i to state %a\n%!"
+ LOG(__ "twopass" 2 "Setting node %i to state %a\n%!"
i StateSet.print v);
a.(i) <- v
auto.bottom_states
else
let tag = Tree.tag tree t in
- LOG("twopass", 2, __ "Traversing node %i (tag %s) in states %a\n%!" (Node.to_int t) (Tag.to_string tag)
+ LOG(__ "twopass" 2 "Traversing node %i (tag %s) in states %a\n%!" (Node.to_int t) (Tag.to_string tag)
StateSet.print states
);
let trans, lstates, rstates =
c
else c
in
- LOG("twopass", 2, __ "\nTransitions are:\n%!");
- LOG("twopass", 2, __ "\nTransitions are:\n%a\n%!"
+ LOG(__ "twopass" 2 "\nTransitions are:\n%!");
+ LOG(__ "twopass" 2"\nTransitions are:\n%a\n%!"
Translist.print trans
);
let s1 = loop (Tree.first_child tree t) lstates ctx
(Uid.to_int trans.Translist.Node.id) c;c
else c
in
- LOG("twopass", 2, __ "Evaluating node %i (tag %s).\n%!States=%a\n%!"
+ LOG(__ "twopass" 2 "Evaluating node %i (tag %s).\n%!States=%a\n%!"
(Node.to_int t)
(Tag.to_string tag)
StateSet.print states
);
- LOG("twopass", 2, __ "Translist=%a\nLeft=%a\nRight=%a\nMark=%s\n\n%!"
+ LOG(__ "twopass" 2 "Translist=%a\nLeft=%a\nRight=%a\nMark=%s\n\n%!"
Translist.print trans
StateSet.print s1
StateSet.print s2
let twopass_top_down_run auto tree root =
let len = Node.to_int (Tree.closing tree root) + 1 in
- LOG("twopass", 2, __ "Creating array of size: %i\n%!" len);
+ LOG(__ "twopass" 2 "Creating array of size: %i\n%!" len);
let states_array = Array.make len StateSet.empty in
let _, cache =
twopass_top_down states_array auto tree root auto.init Tree.nil