[antlr-interest] avoiding nondeterminism warning

Michael Laszlo mjl at nova.edu
Wed Sep 14 11:45:43 PDT 2005


In my parser class I include a literal in the token section:

tokens {
    VAR="var";
}

Also, my lexer includes the rule:

ID:  LETTER (LETTER|DIGIT)* 

and antlr.Tool runs without warning as expected. Fine.

However, now I want to perform an action whenever VAR is scanned so I add this rule to my lexer:

VAR: "var" { inVarDefinition = true; };

This time, antlr.Tool warns about nondeterminism between ID and VAR. I understand the reason for the warning, and the resulting program still works (VAR is matched in preference to ID). But is there a clean way to associate actions with literals while avoiding the nondeterminism warning?

Thanks, Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050914/38626922/attachment.html


More information about the antlr-interest mailing list