[antlr-interest] Need help in understanding DFA prediction

Sam Harwell sharwell at pixelminegames.com
Sun Nov 9 22:52:03 PST 2008

What's the definition for LETTER? If, for example, you have this:


LETTER : 'a'..'z' ;


Then Cake matches CATEGORYSTART because the capital letter C at the
beginning rules out all options but that. Does your LETTER rule allow
capital letters?




From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Sven Prevrhal
Sent: Monday, November 10, 2008 12:08 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Need help in understanding DFA prediction


Hello and thanks Gurus:


I have a Lexer rule



                :               SPACE* 'Categories:';


and the call to DFA.Predict which originates from Lexer.mTokens()
predicts it for input like "Cake", and then of course the call to
mCATEGORYSTART() in the switch statement inside mTokens()after the
DFA.Predict call returns issues an error.


Sooo, how do I get DFA.Predict to predict the WORD rule for "Cake"


Here's my WORD rule:

WORD :                LETTER+;


Thank you and cheers,



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081110/7fd6e46b/attachment.html 

More information about the antlr-interest mailing list