[antlr-interest] Resolving non-determinism: a clarification needed!

Monty Zukowski monty at codetransform.com
Thu Apr 22 21:29:31 PDT 2004


Lexer rules are always upper case, parser rules always lower case, so I 
was confused by your example.  You can use a syntactic predicate:

new_Rule: (constant)=>constant
	| negate;

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

On Apr 22, 2004, at 3:25 PM, Bharath S wrote:

> Hi Monty,
>
> Its actually in the parser. I used upper case for the rules just to 
> give an
> example. Both the rules that I have mentioned are parser rules and not 
> lexer
> rules. Does that give me any edge?
>
> Thanks for your prompt reply!
>
> Bharath
>
>
> -----Original Message-----
> From: Monty Zukowski [mailto:monty at codetransform.com]
> Sent: Thursday, April 22, 2004 4:31 PM
> To: antlr-interest at yahoogroups.com
> Cc: Monty Zukowski
> Subject: Re: [antlr-interest] Resolving non-determinism: a 
> clarification
> needed!
>
> On Apr 22, 2004, at 2:22 PM, Bharath S wrote:
>
>> Eg. new_Rule: (integer | blah | blah | NOT(...|Integer) | blah | 
>> blah);
>>
>> This is just a simple example and I have several such non
>> determinisms. Is
>> this the right way to solve this non-determinism or am I missing
>> something
>> huge? Is this duplication of code an acceptable approach? Please feel
>> free
>> to give your comments.
>>
>> Thanks!
>>
> If you have to handle it in the lexer then that's really the only way
> to do it.  Why not handle it in the parser?
>
> Monty
>
> 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
>
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>



 
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