[antlr-interest] antlrworks 3.0ea8 unreachable error

O.E. Dragon dragonoe at mcmaster.ca
Mon Mar 20 15:13:13 PST 2006


On Mon, 20 Mar 2006 18:05:26 -0500 (EST)
 "Martin d'Anjou" <mdanjou at neterion.com> 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"
> 
> When I change "ID" to lower case "id", it works...
> Am I missing something?

By convention, grammar rule that start with a lower case letter are
expected to be parser rules, and those starting with an upper case
letter are lexer rules.

I don't know how ANTLR v3 works but in v2 you need to put parser rules
in a separate grammar section.

Cheers,
-Olivier


More information about the antlr-interest mailing list