[antlr-interest] Re: Translators Should Use Tree Grammars

atripp54321 atripp at comcast.net
Tue Nov 23 19:03:20 PST 2004



--- In antlr-interest at yahoogroups.com, Monty Zukowski <monty at c...>
wrote:
> atripp54321 wrote:
> 
> > What's the most complex translator that that people
> > have seen? (Complex meaning functionality, not internals).
> 
> Have a look at my writeup of the AREV to VB translator:
> 
> http://www.codetransform.com/fun_with_antlr.html
> 
> Monty

Yes, I had looked at that early on. If you have
more details written up (or have the code
laying around), I'd love to see it.

I think what makes my situation different is the approach I took.
The example you give on that page says you change this:
IF R.CUST.ADDR[1,6] = 'PO BOX'
...to this...
IF (arvEQ(arvSUBSTRING(arvEXTRACT(R_CUST_ADDR, CUA_ADDR_LN1, 0, 0), 1,
6), "PO BOX")

I made a decision early on that I wanted to generate Java code
that looks hand written, even at the expense of possibly not
being correct code! I have a lot of writeup on this at my website.
The other C-to-Java tools (e.g. C2J and Ephedra) do what you're
doing here: generate code that works correctly, but is not at
all what a person would write.

So try to write down the VB code as you would
write it manually, and then figure out how you would do that
translation, and see if a treewalker is still a good fit.
Maybe it will be for you, but I guess I never got comfortable
enough with treewalkers (and I guess ANTLR in general) to
make it a good fit for me.

And thanks so much for writing the cgram grammar - don't know
where I'd be without it (perhaps still at a "real job" :)

Andy





 
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