On Jun 22, 2009, at 1:17 PM, Peter Goodman wrote: > Another idea, previously mentioned, is a production-rule-level > parse error, where if a production rule fails to match one of its > phrases then it will simply cause a parse error.
I believe ANTLR does that unless the invoking rule is backtracking. ANTLR does selective backtracking, only when standard LL(k) or LL(*) parsing is insufficient. Kind of a hybrid. Given a rule with a single production, ANTLR will throw an exception unless the invoker of IdentifierDeclaration was backtracking . > This is very appealing, > especially for production rules with only one phrase where an error > is only detectable on failure of the production rule. The following > is an example of this: > > Type : 'int' : 'float' : 'char' ; > Identifier : !Type ... ; > > IdentifierDeclaration > : Type Identifier IdentifierList <semicolon> > ; > > IdentifierList > : <comma> Identifier IdentifierList > : <> > ; Ter _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg