/// Keyword token Token='token' Start='start' Right='right' Skip='skip' Part='part'; /// Punctuator token Colon=':' Semi=';' Equal='=' LPar='(' RPar=')' LBrak='[' RBrak=']' Or='|' Star='*' Plus='+' Hat='^' Slash='/' Tilde='~' And='&'; /// Identifier for rules and tokens token Id='' Str=''; token Predicate='' Action='' Assertion=''; token NodeRename='' NodeMarker='' NodeCreation=''; token Comment DocComment Whitespace; start file; skip Comment DocComment Whitespace; file: decl*; decl^: token_list | ?1 rule_decl | start_decl | right_decl | skip_decl | part_decl ; start_decl: 'start' Id ';'; right_decl: 'right' (Id | Str)+ ';'; skip_decl: 'skip' (Id | Str)+ ';'; part_decl: 'part' Id+ ';'; token_list: 'token' token_decl+ ';'; token_decl: Id ['=' Str]; rule_decl: Id ['^'] ':' [regex] ';'; regex^: alternation; alternation^: ordered_choice [('|' ordered_choice)+ >]; ordered_choice^: concat [('/' concat)+ >]; concat^: postfix [postfix+ >]; postfix: postfix '*' @star | postfix '+' @plus | '(' [regex] ')' @paren | '[' regex ']' @optional | Id @name | Str @symbol | Predicate @predicate | Action @action | Assertion @assertion | NodeRename @node_rename | NodeMarker @node_marker | NodeCreation @node_creation | '^' @node_elision | '~' @commit | '&' @return ;