[antlr-interest] Re: Stuff I don't like about ANTLR 2.x

lgcraymer lgc at mail1.jpl.nasa.gov
Tue Mar 16 15:05:06 PST 2004


Oliver--

What you can do is
{    RefAST ast = #(#[DISCRIM_PART_OPT, "DISCRIM_PART_OPT"], #empty_discrim_opt);
     astFactory->addASTChild(currentAST, ast);
}
in an action to eliminate the empty rule (C++; java differs in that it converts the -> to . and that ast is an AST, not a RefAST).  
currentAST is defined within the rule, while astFactory is a parser field.


--- In antlr-interest at yahoogroups.com, "oliver_kellogg" <oliver_kellogg at y...> wrote:
> (Sorry if you get this twice - resending because I
>  didn't see my orignial reply on antlr-interest)
> 
> Terence Parr wrote:
> > Ack...yeah, Java's contract for exceptions means you cannot  
> generate 
> > the try/catch if you have nothing to match.  Hm....I guess we could 
> > detect that.
> 
> Sounds like a winner :-)
> 
> > Is it a pain to avoid these just because you have a lot or is there 
> a 
> > semantics reason?
> 
> In ada.g, take a look at the rules decl_common and type_def,
> and their use of the empty_discrim_opt rule.
> I haven't found a simple way of rewriting the rules to
> avoid the empty_discrim_opt rule...
> Perhaps someone has advice for me ?
> 
> Thanks,
> 
>  Oliver



 
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