[antlr-interest] lexical nondeterminism

Ruben Laguna ruben.laguna at gmail.com
Mon Feb 27 13:28:34 PST 2006


Hello,

I have the following two lexical rules

BINDRULEKEYWORD: ("user" ("dn"|"attr")) | "groupdn" | "roledn"  |"ip" ;
RIGHT          : "read" | "write" | "add" | "delete" | ("se" ("arch"
|"lfwrite")) | "compare" | "proxy" ;

which give me the following warnings when I try to compile them
warning:lexical nondeterminism between rules BINDRULEKEYWORD and RIGHT upon
     k==1:'r'
     k==2:'o','r'
     k==3:'l','o'
     k==4:<end-of-token>,'e','r'
     k==5:<end-of-token>,'a'
     k==6:<end-of-token>

I've read about the linear approximate lookahead and I understand that this
is the problem but I haven't found which is the right way to tweak the
grammar file to bea ble to parse correctly "roledn" as a BINDRULEKEYWORD
token.

What are the ways to handle this nondeterminism?

do i need to set up two lexers one for the RIGHT rule and one for the
BINDRULEKEYWORD and then change the parsers rules to switch between lexer
with TokenStreamSelector or there is a better way to handle this?


Thanks in advance /Rubén Laguna


--
/Rubén
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060227/1e1da895/attachment.html


More information about the antlr-interest mailing list