[antlr-interest] Regression? antlr-03-30-2007.14 -> antlr-04-10-2007.18

Terence Parr parrt at cs.usfca.edu
Tue Apr 17 15:25:50 PDT 2007


On Apr 17, 2007, at 2:50 PM, David Holroyd wrote:
> With the 03-30-2007.14 build, my for-loops worked and the following
> syntax was accepted:
>
>   for (var b=1;b<=10;b++) { bar(); }
>
> with 04-10-2007.18, they don't parse any more, with  
> NoViableAltException
> reported at the 'var'.
>
> Here is the slightly simplified rule:
>
> forStatement
>     :   f=FOR
>         LPAREN
>         (    (forInClauseDecl IN)=>forInClause -> ^(FOR_IN[$f]  
> forInClause)
>         |    traditionalForClause -> ^($f traditionalForClause)
>         )
>         RPAREN
>         statement -> $forStatement statement
>     ;
>

> A difference I notice in the generated code is that the top level
> alternative logic used to simply test LA(1) for the alternatives
> following LPAREN, whereas the newer code does an equivalent test &&
> synpred3() in all cases.  [synpred3() is the '(forInClauseDecl IN)=>']

Yeah, i had to make synpreds always evaluate but they do so now on  
every DFA transition...

Ok, DFA looks correct but the synpred mechanism might not be working  
properly...I'll try to make some more examples.

Ter


More information about the antlr-interest mailing list