2 // use 'a'-'z' or 'a-z' instead of [a-z]?
4 // #include (with renaming?)
5 // ANTLR uses ! and ^ suffixes
7 s = !ws (grammar::Grammar) !ws
8 Grammar = NonTerminal +/ ws
9 NonTerminal = Word ^"=" RHS /ws
11 RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
15 PreSequence = ps:: Elements
16 | (Quoted|Word) ^"::" PreSequence /ws
17 > PreSequence ^"/" e /ws
18 | PreSequence ^"->" e /ws
20 Sequence = psx:: PreSequence
21 | Sequence ^"&" Elements /ws
22 | Sequence ^"&~" Elements /ws
30 e = (Quoted|Word) ^":" e
35 | ^"{" PreSequence "}" /ws
54 Quoted = "\"" ((~[\"\\] | escaped)+) "\""
56 escaped = "\n":: "\\n"
62 | "()":: w** "//" ~[\n]* "\n" ws