[antlr-interest] template generation for dumb rules

Terence Parr parrt at cs.usfca.edu
Tue Mar 25 12:38:23 PDT 2008


On Mar 25, 2008, at 12:26 PM, Gavin Lambert wrote:
> At 08:07 26/03/2008, Terence Parr wrote:
> >Agreed...but what about
> >
> >d : id (',' id) ';' ;
> >
> >what should i produce here? In other words, when do I stop doing
> >the default behavior and force you to say how it works?  Do i
> >even put in the literals into the result template?  Maybe.
>
> By default, probably yes, that's the most sensible thing to do.  If  
> they don't want the literals in the output, then they can specify  
> the template they want instead.
>
> In fact, by doing this you're basically saying that the default  
> output of a template-output ANTLR parser will be the same as its  
> input; and that will probably help the people who are trying to do  
> fairly minimal rewrites (and those doing more extensive rewrites are  
> probably outputting to AST anyway).

yeah, was starting to wonder that as i wrote my last reply ;)   
symmetry is good ;)

> Then again, you should probably only take what I say with a grain of  
> salt, since I've mostly only done "toy" projects with ANTLR at this  
> point.

Well, i wanted to wait on this func. until i had some  
experience...nothing in my exp. so far indicates copying in->out would  
be an issue. Hmm...

Ter



More information about the antlr-interest mailing list