[antlr-interest] Resolving conflict between keyword and identifier

SAGAR BIYANI sagarbiyani at yahoo.com
Mon Feb 11 23:15:49 PST 2002


Hi John,
     Could you please mail me the sample keyword rule
containing the list of tokens. 

Thanks,
Sagar

--- John Green <greenj at ix.netcom.com> wrote:
> In my lexer I use:
> 
> ID
> options {
>         testLiterals = true;
> }
> 	:	('a'..'z'|'_'|'$')
> 	etc.
> 
> and then for the keyword rule I have a list of token
> types rather than a
> list of string literals.
> 
> Works for me, with many hundreds of keywords. (Of
> course, make the keywords
> list big enough and you can run into the old
> "virtual memory exhausted"
> error from G++, but that's another issue)
> 
> HTH
> John Green
> www.joanju.com
> 
> 
> > -----Original Message-----
> > From: SAGAR BIYANI [mailto:sagarbiyani at yahoo.com]
> > Sent: Sunday, February 10, 2002 7:41 PM
> > To: antlr-interest at yahoogroups.com
> > Subject: [antlr-interest] Resolving conflict
> between keyword and
> > identifier
> >
> >
> > Hi,
> >
> > I am writing grammar for SQL. Trying to resolve
> > conflict between keyword and identifier through
> the
> > following rules:
> >
> > keyword: "access" |"admin" ... ;
> >
> > id: ID |keyword;
> >
> > The above rule works only if the keywords defined
> in
> > the keyword rule is less. If it exceeds above
> certain
> > limit(approx 100), ANTLR generates wrong code in
> the
> > parsers (starts ignoring predicates) and hence the
> > whole thing is not working. Anybody know how to
> > resolve this problem?
> >
> > Thanks in advance.
> >
> > -Sagar
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> >
> >
> 
> 
>
_________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at
> http://mail.yahoo.com
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/ 
> 
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

 

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



More information about the antlr-interest mailing list