[antlr-interest] token definitions can never be matched because prior tokens match the same input

Randall R Schulz rschulz at sonic.net
Fri Nov 28 15:15:52 PST 2008


On Friday 28 November 2008 15:05, Ilya Sterin wrote:
> Based on the grammar you provided it doesn't seem you've defined it
> correctly.  First, I'd define some of your patterns as lexer tokens.
> Try this...

I think it's important to make clear the fact that ANTLR encodes a fixed 
naming convention that makes rules whose names begin with a lower-case 
letter produce parser productions and those whose names begin with an 
upper-case letter produce lexer / scanner rules.

It was the first problem I had when first using ANTLR...

The next less will be to understand that the scanner / lexer fully 
processes the input (breaking it into a sequence of tokens) and 
completes its work before the parser begins executing.


Randall Schulz


More information about the antlr-interest mailing list