[antlr-interest] nondeterminism problem

Jack Hong jack_xu_hong at yahoo.ca
Fri Oct 11 21:47:26 PDT 2002


Dear Terence,

You are great!  I fixed the problem by adding "testLiterals=true" into
my lexer.  Thank you very much!

Jack

-----Original Message-----
From: Terence Parr [mailto:parrt at jguru.com] 
Sent: October 12, 2002 12:40 AM
To: antlr-interest at yahoogroups.com
Subject: Re: [antlr-interest] nondeterminism problem



On Friday, October 11, 2002, at 09:20  PM, Jack Hong wrote:

> Terence,
>
> Thank you so much.
>
> I tried that way before, but somehow it didn't work well.
>
> This is the parser rule I declared in the parser before:
> //---------------------------------------------
> boolean_literal returns [Boolean b]
> {
>         b = null;
> }
>         :       "TRUE" { b = new Boolean(true); }
>         |       "FALSE" { b = new Boolean(false); }
>         ;
> //---------------------------------------------
>
> It looks good, but always returns null.  So I added a token 
> BOOLEAN_LITERAL in the lexer, after that my parser can retrieve the 
> correct value, but another problem raised -- nondeterminism.
>
The above parser rule should work.  You must have a token type issue 
like import/exportVocab.  If the parser/lexer are not in the same file 
you will have to have the lexer import the vocab.  Also check to ensure 
you are not turning of "testLiterals".

Terence


 

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


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

 

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



More information about the antlr-interest mailing list