[antlr-interest] Stuff I want improved in antlr and Code Generation/Optimization.
Bharath S
payasam79 at yahoo.com
Fri Mar 12 05:21:56 PST 2004
Hi Matthew,
Terrence suggested using jBURG(java bottom-up rewrite
generator) for code generation/optimization. Did you
get a chance to look at it? I'm relatively new to
AntLR/jBURG, so pardon me if you were talking about
problems with jBURG implicitly.
Good luck.
B.
--- matthew ford <Matthew.Ford at forward.com.au> wrote:
> I had trouble with the mutlti-pass
> translator/optimizer I built.
>
> The translation was not 1:1 It produced an
> algorithmic numerical derivative
> of the input expression (not a symbolic derivative).
> Algorithmic derivatives accurately calculate the
> derivative of a function
> numerically at a given point without using the small
> differences usually
> found in
> numerical derivatives, but you would not want to
> write the code by hand even
> for simple functions.
> So the tree manipulations were extreme with mulitple
> replications of
> slightly different versions of various branches.
>
> The problems mainly had to do with getting the
> result tree back into the
> main tree without infinite loops and also cutting
> up, adding new sub-trees
> and stitching back together various parts of the
> branch in one go.
> I ended up doing most of it by hand coded
> optimization routines that worked
> on expressions identified by the tree walker.
>
> My comments on reworking of the tree syntax is an
> attempt to overcome this
> problem as the hand coded stuff is
> messy and hard to support now that I have forgotten
> what I was doing.
>
> matthew
>
> ----- Original Message -----
> From: "John D. Mitchell" <johnm-antlr at non.net>
> To: <antlr-interest at yahoogroups.com>
> Sent: Friday, March 12, 2004 3:39 AM
> Subject: [antlr-interest] Code
> Generation/Optimization.
>
>
> > >>>>> "Bharath" == Bharath S <payasam79 at yahoo.com>
> writes:
> > [...]
> >
> > > My understanding is that AntLR can be used to
> generate the front-end of
> a
> > > compiler (lex-parser-AST). What about the
> backend? (code
> > > generation/optimization?). As of now, I am
> getting clear ideas about
> > > defining the "structured text" language's
> syntax+semantics; How would i
> > > convert it to bytecode?
> >
> > Basically, write a set of tree grammars that
> performs various tree
> > transformations (such as optimizations) and side
> effects (such as use-def
> > chains, constants table creation, etc.) and then a
> final tree grammar
> which
> > takes all of that and spits out the output in your
> desired format.
> >
> > Of course, it goes without saying that the output
> of that last pass may
> > also be the input for other code generation tools.
> >
> > Have fun,
> > John
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
>
>
>
>
> Yahoo! Groups Links
>
>
> antlr-interest-unsubscribe at yahoogroups.com
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com
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