[antlr-interest] non-determinism.

mzukowski at yci.com mzukowski at yci.com
Tue Mar 25 09:44:55 PST 2003


remove your AT rule and then add a literal keyword AT='@' to the keywords
section and test for it in TOKEN by turning on the option testLiterals=true.
See the docs on literals.

Monty

-----Original Message-----
From: mark kant [mailto:markkant2001 at yahoo.com]
Sent: Tuesday, March 25, 2003 9:42 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] non-determinism.


Hi,

I get non-determinism in the following lexer (relevant
portion of parser and lexer)

hosport: host COLON password

password: TOKEN

host: NAME AT TOKEN


lexer ...............

COLON: ':'

SEMI: ';'

AT: '@'

TOKEN: ('a'..'z' | 'A'..'Z'
|'0'..'9'|'.'|':'|';'|'@')+


What is the best way to resolve it:
1. multiple lexers
2. syntactic predicates - not appropriate as I have
other similar rules for special characters
3. some kind of flag set in parser and lexer checks it
before matching a rule in lexer (how do I communicate
the flag state from parser to lexer). I have done this
in Lex and YAcc.

Thanks

Mark

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list