[antlr-interest] Keywords Vs Identifiers.

Monty Zukowski monty at codetransform.com
Wed May 19 14:41:01 PDT 2004


See the documentation about "literals"

Monty

On May 19, 2004, at 8:25 AM, Bharath S wrote:

> Hi Antlers,
>
> I have some rules in my grammar, for time literals which require that 
> 'TIME'
> or "time" be appended to the front of the rule. For eg., time can
> represented as TIME 99secs. The problem is, "TIME" is not a keyword 
> and so I
> cant have it in the parser. If I throw it in the lexer, it causes a 
> clash
> with IDENTIFIER rule, because the lexer sees the rule as
>
> TIME: 'T' 'I' 'M' 'E' (Integer) ; and
> IDENTIFIER: ('a'..'z'|'A'..'Z')+;
>
> as expected. Is there a common workaround for this?
>
> I can solve this problem by moving a whole bunch of rules in the 
> parser back
> to the lexer, just to make the TIME rule protected. But it doesnt make
> sense, at all.
>
> Any comments are most welcome.
>
> Bharath.
Monty Zukowski

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
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