/// Keyword token Token='token' Start='start' Right='right' Skip='skip'; /// Punctuator token Colon=':' Semi=';' Equal='=' LPar='(' RPar=')' LBrak='[' RBrak=']' Or='|' Star='*' Plus='+'; /// Identifier for rules and tokens token Id='' Str=''; token Predicate='' Action='' Binding=''; token OpenNode='' CloseNode=''; token Comment DocComment Whitespace; start file; skip Comment DocComment Whitespace; file: decl*; decl: token_list | rule_decl | start_decl | right_decl | skip_decl ; start_decl: 'start' Id ';'; right_decl: 'right' (Id | Str)+ ';'; skip_decl: 'skip' (Id | Str)+ ';'; token_list: 'token' token_decl+ ';'; token_decl: Id ['=' Str]; rule_decl: Id ':' [regex] ';'; regex: alternation; alternation: concat ('|' concat)*; concat: postfix postfix*; postfix: postfix ('*' | '+') | atomic | paren | optional ; paren: '(' regex ')'; optional: '[' regex ']'; atomic: Id | Str | Predicate | Action | Binding | OpenNode | CloseNode ;