[antlr-interest] Re: how to eliminate non-determinism warnings upon keywords and literals?

Lubos Vnuk lubos.vnuk at rts.at
Thu Mar 11 08:14:34 PST 2004


Why not put semantic actions in the parser?

Or you could turn off the testLiterals option, call testLiteralsTable
() and check the return in the lexer rule manually.

HTH,
Lubos.

--- In antlr-interest at yahoogroups.com, "Fan Yang" <yhhf_dy at y...> 
wrote:
> Hi,
> 
> There are some non-determinism warnings for the following grammar
> 
> ////// snippit1
> class TestLexer extends Lexer;
> ...
> TOKEN_IFDEF	:	"ifdef" { semantic actions }
> 	;
> 
> ID	:	('a'..'z')+
> 	;
> //////
> 
> I know I can use token {...} section to eliminate those warnings, 
but 
> I can't add semantic actions in the tokens section, which is 
> important for me. 
> 
> My question is how to get rid of those warnings by using the same 
way 
> as snippit1 indicated.
> 
> 
> I really appreciate your help,
> 
> fan 
> 
> ////// snippit2
> // One solution but I can't use semantics action
> class TestLexer extends Lexer;
> ...
> tokens {
>         BEGIN="begin";
> }
> 
> ID	:	('a'..'z')+
> 	;



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list