[antlr-interest] minor 3.0b4 bug?

John B. Brodie jbb at acm.org
Sat Oct 7 06:35:14 PDT 2006


>...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