1 s = !ws (grammar::Grammar) !ws
2 Grammar = NonTerminal +/ ws
3 NonTerminal = Word ^"=" RHS /ws
5 // use 'a'-'z' or 'a-z' instead of [a-z]?
7 // #include (with renaming?)
8 // ANTLR uses ! and ^ suffixes
10 RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
14 PreSequence = ps:: Elements
15 | (Quoted|Word) ^"::" PreSequence /ws
16 > PreSequence ^"/" e /ws
17 | PreSequence ^"->" e /ws
19 Sequence = psx:: PreSequence
20 | Sequence ^"&" Elements /ws
21 | Sequence ^"&~" Elements /ws
29 e = (Quoted|Word) ^":" e
33 | ^"{" PreSequence "}" /ws
52 Quoted = "\"" ((~[\"\\] | escaped)+) "\""
54 escaped = "\n":: "\\n"
60 | "()":: w** "//" (~[\n])* "\n" ws