[antlr-interest] Re: ANTLR and guarded predicates

mzukowski at bco.com mzukowski at bco.com
Wed Mar 20 11:09:08 PST 2002


Oh wait, this is going to change the sem pred into a validating predicate
instead of a disambiguating one, isn't it?  My solution may not work.  I
have to do some research on this.  Something in the back of my head says
that the sem pred gets thrown in with the lookahead test instead of waiting
for the syn pred.  I gotta check it out tho.

Monty

> -----Original Message-----
> From: lgcraymer [mailto:lgc at mail1.jpl.nasa.gov]
> Sent: Wednesday, March 20, 2002 11:03 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Re: ANTLR and guarded predicates
> 
> 
> --- In antlr-interest at y..., mzukowski at b... wrote:
> > I don't have time to look into why it's not working right now, but 
> you could
> > certainly get by with a subrule:
> > 
> > production: (syntax guard)=>({semantic test}? another_production)
> >           | some_other_production
> >           ;
> > 
> > Also note that PCCTS properly hoisted predicates into 
> calling rules. 
>  ANTLR
> > does not, you will have to manually hoist the rule yourself, like I 
> did with
> > the typedef rule in the GCC grammar.
> > 
> > Monty
> 
> ANTLR attaches sempreds to subrules (explicit or implied) internally, 
> so Monty's solution should work properly.  Fixing the internals 
> without breaking something else might be difficult:  as Ric has 
> mentioned in other emails, ANTLR's internal "tree" (custom, 
> unfortunately, not AST-based) structure is messy to deal with and 
> needs a redesign/rewrite.
> 
> --Loring
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 
> 

 

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



More information about the antlr-interest mailing list