Parser File Grammar

parser‑file declaration*
declaration using‑directive | parser‑declaration
using‑directive using‑alias‑directive | using‑namespace‑directive
using‑alias‑directive using identifier = qualified‑id ;
using‑namespace‑directive using qualified‑id ;
parser‑declaration parser id { statement* }
statement main‑statement | using‑statement | lexer‑statement | rule‑info‑statement | rule‑statement
main‑statement main ;
using‑statement using using‑qualified‑id ;
using‑qualified‑id id (. id)*
lexer‑statement uselexer id ;
rule‑info‑statement ruleinfo { (rule‑info % ,)? }
rule‑info ( id , string )
rule‑statement id parameters‑and‑variables? return‑type? ::= rule‑body ;
parameters‑and‑variables ( (param‑or‑variable % ,)? )
param‑or‑variable var type‑expr identifier | type‑expr identifier
return‑type : type‑expr
rule‑body alternative
alternative sequence (| sequence)*
sequence difference difference*
difference list (- list)*
list postfix (% postfix)?
postfix primary (* | + | ?)?
primary (rule‑call | primitive | grouping) !? compound‑statement (/ compound‑statement)??
rule‑call nonterminal (( expression‑list ))? : id
nonterminal id
primitive empty | any | id | character | string
grouping ( alternative )