[antlr-interest] antlrworks 3.0ea8 unreachable error

Terence Parr parrt at cs.usfca.edu
Mon Mar 20 15:29:49 PST 2006


On Mar 20, 2006, at 3:05 PM, Martin d'Anjou wrote:

> The following highly simplified grammar:
>
> grammar mygrammar;
> def	:	ID;
> ID	:	LETTER;
> LETTER	:	'a';
>
> Gives me this error in antlrworks:
>  "The following token definitions are unreachable: LETTER"

ID is a letter is an 'a' hence the two are equivalent.  ANTLR chooses  
first.  You want

ID : LETTER+ ;

fragment LETTER : 'a' ;

I think.

Ter



More information about the antlr-interest mailing list