[antlr-interest] parser synpred bug in antlr-03-16-2007.14

Loring Craymer lgcraymer at yahoo.com
Fri Mar 16 16:06:23 PDT 2007


Allen--

As he mentioned earlier, Ter is fixing the error
reporting for this.  However, you still need to
reorganize your code if you are going to use synpreds:

a:
   ('a' 'b') => 'a' 'b';
   | 'a'
   ;

Syntactic predicates impose an ordering of
alternatives.  In your formulation, the synpred is
attached to an "unreachable" alternative.  Better
still would be to define

a:
    'a' ('b')?
    ;

(left factoring).

--Loring


--- Allen Short <washort at divmod.com> wrote:

> grammar tiny;
> 
> a:
>         'a'
>     |   ('a' 'b') => 'a' 'b';
> 
> 
> Upon compiling:
> 1. ERROR in tinyParser.java (at line 37)
> 	if ( (LA1_1==5) && (synpred1())) {
> 	                    ^^^^^^^^
> The method synpred1() is undefined for the type
> tinyParser
> 



 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/


More information about the antlr-interest mailing list