[antlr-interest] minor 3.0b4 bug?

Robert Hill rob.hill at blueyonder.co.uk
Sat Oct 7 11:38:09 PDT 2006


Ahh, I see now. I knew it wasn't a 'real' error since if I added a token
into the paramList rule, the error went away, I just didn't understand where
Alt 2 was coming from.

Thanks!

Rob


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of John B. Brodie
> Sent: 07 October 2006 14:35
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] minor 3.0b4 bug?
> 
> >...snipped...
> >
> >service	:  LParen paramList* RParen ;
> >paramList
> >	:
> >	;
> >I get the following error :
> >
> >ANTLR Parser Generator   Early Access Version 3.0b4 (??, 2006)  1989-2006
> >D:\ActiveProjects\IdeaProjects\Jtest1\src\SGenParser.g:86:12: Decision
> can
> >match input such as "RParen" using multiple alternatives: 1, 2
> >As a result, alternative(s) 2 were disabled for that input
> >D:\ActiveProjects\IdeaProjects\Jtest1\src\SGenParser.g:86:12: The
> following
> >alternatives are unreachable: 2
> >
> >Where is Alt 2?
> >
> >...snipped...
> 
> think of the above two rules as this equivalent
> 
> service : LParen aUniqueRuleName RParen ;
> 
> aUniqueRuleName : /*empty*/ | paramList aUniqueRuleName ;
> 
> paramList : /*empty*/ ;
> 
> the rule introduced by the transformation has two alternatives which, in
> this
> case, are both empty.  leading to the reported ambiguity problems.
> 
> Hope this helps...
>    -jbb




More information about the antlr-interest mailing list