[antlr-interest] DMQL Grammar - ANTLR Eats Characters

Gavin Lambert antlr at mirality.co.nz
Fri Mar 20 17:04:02 PDT 2009


At 08:58 21/03/2009, Terence Parr wrote:
 >Well, come to think of it, I have not tried it a while but:
 >
 >A : ('(' A ')')=> '(' A ')'
 >    | '(' A* ')'
 >   ;
 >
 >should work.  Yep, seems to:
 >
 >             if ( (LA2_0=='(') ) {
 >                 int LA2_1 = input.LA(2);
 >
 >                 if ( (synpred1_T()) ) {
 >                     alt2=1;
 >                 }
 >                 else if ( (true) ) {
 >                     alt2=2;
 >                 }

I suspect we're arguing from different usages of the word 
"backtracking" :)

I was referring to *automatic* backtracking (a la "backtrack=true" 
option).  I know that explicit predicates work ok.



More information about the antlr-interest mailing list