-s ::= !ws Grammar ws => "gram"
-Grammar ::= NonTerminal +/ ws => "grammar"
-NonTerminal ::= word ^"::=" RHS /ws
+s = !ws Grammar ws => "gram"
+Grammar = NonTerminal +/ ws => "grammar"
+NonTerminal = word !wp ^"=" !wp RHS
+
+RHS = (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
-RHS ::= (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
-
-Conjuncts ::= Sequence
+Conjuncts = Sequence
| Sequence ^"&" Elements /ws
| Sequence ^"&~" Elements /ws
-Elements ::= e*/ws
-
-psy ::= Elements => "ps"
- | psy !wp ^"/" !ws e
-psx ::= psy => "psy"
- | psy ^"->" e /ws
-Sequence ::= Quoted => "qprod"
- > psx => "psx"
- | psx "=>" ^"[]" /ws
- | psx ^"=>" ("()"|word|Quoted) /ws
-
-ec ::= ~[\-\]\\]
+Elements = e*/ws
+
+PreSequence = Elements => "ps"
+ | PreSequence !wp ^"/" !ws e
+ | PreSequence ^"->" e /ws
+// | (Quoted|word) ^"::" PreSequence /ws
+ | PreSequence ^"=>" ("[]"|"()"|word|Quoted) /ws
+Sequence = PreSequence => "psx"
+
+ec = ~[\-\]\\]
| escaped
-Range ::= ec => "range"
+Range = ec => "range"
| ec ^"-" ec
-e ::= word => "nonTerminal"
+e =
+ (Quoted|word) ^":" e
+ > word => "nonTerminal"
| Quoted => "literal"
| ^"()"
| ^"{" Sequence "}" /ws
| ^"[" Range* "]"
-
| e ^"++" /ws -> ~[/]
| e ^"+" /ws -> ~[+]
| e ^"++/" e /ws
| e ^"*/" e /ws
| ^"!" e /ws
| e ^"?" /ws
- | "^" Quoted /ws => caret
+ | ^"^" Quoted /ws
| "(" word ^")" /ws
> ^"(" RHS ")" /ws
| ^"~" e
-word ::= [a-zA-Z0-9_]++
-Quoted ::= "\"" ((~[\"\\] | escaped)+) "\""
+word = [a-zA-Z0-9_]++
+Quoted = "\"" ((~[\"\\] | escaped)+) "\""
| "\"\"" => ""
-escaped ::= "\\n" => "\n"
+escaped = "\\n" => "\n"
| "\\r" => "\r"
| "\\" ~[nr]
-w ::= " " | "\n" | "\r"
-ws ::= w** => ()
+w = " " | "\n" | "\r"
+ws = w** => ()
| w** "//" ~[\n]* "\n" ws => ()
-wp ::= w++
+wp = w++