[antlr-interest] lexer question from newbie

Terence Parr parrt at cs.usfca.edu
Thu Dec 22 16:55:43 PST 2005


On Dec 22, 2005, at 4:40 PM, Stuart wrote:

> I am trying to use Antlr for the first time.  I have used
> yacc/lex only a couple times, and this is my first time
> using an LL parser so I am basically clueless... :-)
>
> Below is my attempt at a lexer for a simple LaTeX-like
> language.  It was fine until I added the ECHR rule.
> Now, I get a warning:
>   latex.g: warning:lexical nondeterminism between rules CMD and  
> TEXT upon
>   latex.g:     k==1:'\\'
>   latex.g:     k==2:'A'..'Z','a'..'z'

I think this is a limitation of the linear approx lookahead.  It  
improperly combines sets to \A looks like TEXT can match it.  Since  
CMD is first, it will resolve properly, however.  You can ignore the  
error I'm pretty sure.  Sorry for the ugliness.

Ter



More information about the antlr-interest mailing list