[antlr-interest] Re: Determinig the real ambiguities

thrutchy eric_mahurin at yahoo.com
Thu Jul 15 13:19:20 PDT 2004


Thanks.  I'll use this.  I was trying come up with an example that
wasn't so easily solved.  Here's another that I'm using and haven't
figured out:

a_or_b
    : expression A
    | constant_expression B
    ;

constant_expression is a rule that matches a subset of expression.  A
can follow an expression (or constant_expression) and B can only
follow a constant_expression.

But, I'm really not trying to solve a specfic ambiguity in a rule. 
I'm wanting to discuss this in general terms.

Eric

--- In antlr-interest at yahoogroups.com, Anakreon <anakreonmejdi at y...>
wrote:
> Monty should have provided the answer to your question.
> Instead of
> a_must_have_c : (A)? (B)+ C D | (B)+ D ;
> I would try this to resolve the ambiguities:
> a_must_have_c 
> :
> A (B)+ C D
> | (B)+ (C)? D
> ;
> 
> I guess this should not generate ambiguities and matches
> the same input as your version of a_must_have_c.
> 
> Anakreon.



 
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