+Grammar = Declaration +/ ws
+
+Declaration = NonTerminal
+ | ^"#import" ws! FileName (ws! "as" ws! Word)?
+
+FileName = FileNameChar+ -> [\r\n ]
+FileNameChar = Space:: "\\ "
+ | ~[\r\n ]
+
+NonTerminal = Word "=" RHS /ws
+ | Word "*" ws! ^"=" ws! RHS
+ | Word "*/" Word ws! ^"=" ws! RHS
+
+RHS = (Sequence +/ (ws! "|" ws!)) +/ (ws! ">" ws!)
+
+Elements = e*/ws
+
+PreSequence = Elements
+ | (Quoted|Word) ^"::" PreSequence /ws
+ > PreSequence ^"/" e /ws
+ | PreSequence ^"->" e /ws
+
+Sequence = psx:: PreSequence
+ | Sequence ^"&" Elements /ws
+ | Sequence ^"&~" Elements /ws
+
+ec = ~[\-\]\\]
+ | escaped
+
+Range = ec
+ | ec "-" ec
+
+e = (Quoted|Word) ^":" e
+ > NonTerminalReference
+ | Literal
+ | ^"()"
+ | ^"{" PreSequence "}" /ws
+ | ^"[" Range* "]"
+ | e ^"++" /ws -> ~[/]
+ | e ^"+" /ws -> ~[+]
+ | e ^"++/" e /ws
+ | e ^"+/" e /ws
+ | e ^"**" /ws -> ~[/]
+ | e ^"*" /ws -> ~[*]
+ | e ^"**/" e /ws
+ | e ^"*/" e /ws
+ | e ^"!"
+ | e ^"?" /ws
+ | ^"^" Quoted
+ > ^"(" RHS ")" /ws
+ | ^"~" e
+ | ^"\\{"
+ | ^"\\}"
+
+NonTerminalReference = Word
+Literal = Quoted
+Word = [.a-zA-Z0-9_]++
+Quoted = "\"" ((~[\"\\] | escaped)+) "\""
+ | EmptyString
+ EmptyString = "\"\""
+
+escaped = "\n":: "\\n"
+ | "\r":: "\\r"
+ | "\\" ~[nr]
+
+w = " " | "\n" | "\r"
+ws = w**
+ | w** "//" (~[\n])*! "\n" ws!
+wp = w++