[antlr-interest] Re: Assigning perorities to different production rules

lgcraymer lgc at mail1.jpl.nasa.gov
Fri Nov 19 04:09:51 PST 2004



Syntactic predicates will prioritize alternatives.  From your
description, I suspect that there is another problem and that you mean 

addingexpression:  IDENT ( (DOT! IDENT)* | DOT CONTAINS^ ) ;

I think that what you want is

addingexpression:
    IDENT
    (    (DOT CONTAINS => DOT CONTAINS^
    |    (DOT! IDENT)*
    )
    ;

--Loring

--- In antlr-interest at yahoogroups.com, Muhammad Masoom Alam
<doublemalam at y...> wrote:
> 
> Dear all,
> 
> I have one confusion regarging production rules 
> 
> suppose i have production rule as follows
> 
> expression :addingexpression;
> 
> addingexpression : IDENT  (DOT! IDENT)* | DOT CONTAINS^
> 
> now the probelm is that the first possibitlty god executed and not
the 2nd one as CONTAINS is a key word but a also a valid
identifier.and as a result first possiblity is always executed not the
2nd one, is there is any way to assign some perority to these rules so
that it should check for the 2nd one as well.
> 
> Regards.
> 
> Muhammad.
> 
>  
> 
>      
> 
> : 
> 
> now adding 
> 
> 		
> ---------------------------------
> Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with
Yahoo! Mail to make your dream a reality.





 
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