{ v1a Parse the ixml trace lines printed by xmq --trace (used by the OpenMike scripts). }

parse = line++-#a, -#a?.
-line = ixml-gr|
        ixml-nt|
        ixml-pa-token|
        ixml-pa-step|
        ixml-pa-trace|
        ixml-pa-debug|
        ixml-pa-view|
        ixml-pa-state|
        ixml-bt-step|
        ixml-bt-info.

{ grammar and non-terminal predictions }
ixml-gr = -'(ixml.gr) ', ~[#a]+.
ixml-nt = -'(ixml.nt)', ~[#a]+.

{ pa = parse }
ixml-pa-step = -'(ixml.pa.step) @',tok_i, -' ', dr, -' ', type, -'/', n, -' ', rule.
ixml-pa-trace = -'(ixml.pa.trace) @',tok_i, -' ', info.
ixml-pa-debug = -'(ixml.pa.debug) @',tok_i, -' ', info.
ixml-pa-view = -'(ixml.pa.view) @',tok_i, -' ', info.
-ixml-pa-state = -'(ixml.pa.state) ', -~[#a]+.

{ bt = build tree }
ixml-bt-step = -'(ixml.bt.step) adding ', dr, -~[#a]+.
ixml-bt-info = -'(ixml.bt.info) ', info.

ixml-pa-token = -'(ixml.pa.token) @',tok_i, -' ',char.

tok_i = [N]+.
char = -"'",~[#a],-"'" | 'ω' | '#',[N;L]+.

type = 'none' | 'part' | 'full' | 'block'.
n = [N]+.

{ S →  · S '+' M }
rule = name, ' →', -' '+, body?, dot_body?.
name = [L;N;'|[]_#-$;+!~']+.
body = ~['· ';#a], ~[#a;'·']*.
dot_body = '·', ~[#a]*.

dr = -'(d',id,-',',from,-'-',to,-')'.
id = [N]+.
from = [N]+.
to = [N]+.

info = ~[#a]+.