[antlr-interest] warning:lexical nondeterminism between rulesVARTYPE and IDENT upon....

Anthony Youngman Anthony.Youngman at eca-international.com
Mon Jan 17 04:16:19 PST 2005

The problem is simple - your VARTYPEs can match either the VARTYPE or
IDENT rules. Hence the inderterminism.

I notice you've got "testLiterals" set to true for IDENT, so just
declare "int", "float" etc as literals, and scrap the VARTYPE rule

You can then either test for them in the IDENT rule, or the parser. (By
declaring them as literals, they will be allocated their own types for
parsing purposes - they won't be type IDENT.)


-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of clocKwize
Sent: 16 January 2005 22:39
To: antlr-interest at antlr.org
Subject: [antlr-interest] warning:lexical nondeterminism between
rulesVARTYPE and IDENT upon....

hey, in my lexer i have this:

    options { paraphrase = "a variable type"; }
        :    ("int" | "float" | "string" | "bool")
    options { paraphrase = "an identifier"; testLiterals = true; }
        :    ('a'..'z' |'A'..'Z') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*

MyLexer.g: warning:lexical nondeterminism between rules VARTYPE and 
IDENT upon
MyLexer.g:     k==1:'b','f','i','s'
MyLexer.g:     k==2:'l','n','o','t'

it works ok as far as i know though, i'm not sure how to print a list of

the tokens from the lexer into the console (cpp)

anyway, how do i turn the warning off?


This transmission is intended for the named recipient only. It may contain private and confidential information. If this has come to you in error you must not act on anything disclosed in it, nor must you copy it, modify it, disseminate it in any way, or show it to anyone. Please e-mail the sender to inform us of the transmission error or telephone ECA International immediately and delete the e-mail from your information system.

Telephone numbers for ECA International offices are: Sydney +61 (0)2 8272 5300, Hong Kong + 852 2121 2388, London +44 (0)20 7351 5000 and New York +1 212 582 2333.


More information about the antlr-interest mailing list