[antlr-interest] Re: more specific (lang independent?) actions (WAS: header sections)
lgcraymer
lgc at mail1.jpl.nasa.gov
Thu Nov 18 16:16:21 PST 2004
--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
>
> On Nov 18, 2004, at 2:34 PM, lgcraymer wrote:
> >> section fields {
> >> ....
> >> }
> >
> > I like the way this discussion has been going, but even better would
> > be to use a language qualifier where appropriate:
> >
> > java header { ... }
> > or
> > cpp options { ... }
> > or
> > python init { ... }
>
> Ooooh. Yeah, that way you'd know when you have a problem converting a
> grammar to a different language.
>
> That said, it seems like some should be universal so you don't have to
> change per target:
>
> init {...}
Actually,
options { ... }
is probably a better example--init sections would likely contain code,
and it might not be unusual to have a grammar that contained, say
python init { ... }
OCaml init { ... }
and can generate code for either target. [There would be both generic
options and target-dependent options.] That does assume that the
attribute and output template support is a big help in achieving
target independence for most things and that we are talking about the
few bits that do not fit. I believe that Ric's 3.0 C code generator
is a strong indicator that the assumption is valid.
--Loring
> right?
>
> Ter
> --
> CS Professor & Grad Director, University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Cofounder, http://www.jguru.com
> Cofounder, http://www.knowspam.net enjoy email again!
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