[antlr-interest] (in)sanity check

Monty Zukowski monty at codetransform.com
Mon Apr 19 14:06:46 PDT 2004


On Apr 19, 2004, at 12:50 PM, ljw10001 wrote:

> What I have in mind is to use ANTLR/Sorcerer to do a rough
> translation.
>
> If I'm reading the various documents, articles, etc. correctly, there
> is a C++ grammar available that ANTLR can use to create a parse tree
> and also a Sorcerer description for Java that can read a (different)
> parse tree and generate java code. Presumably the first tree could be
> mapped to the second, or we could modify the Sorcerer description by
> hand to use the tree generated from the C++ source.

This is possible with ANTLR, but it is also a huge project.  You may 
get a lot of mileage out of existing tools, such as Loring's suggestion 
Ephedra.  All research and time playing with existing tools will be 
time well spent.

Read my article "Translation Project Planning" 
http://www.codetransform.com/planning.html.  Also see my write-up about 
translating AREV to VB http://www.codetransform.com/fun_with_antlr.html 
for more details on how that project went.

You may also be interested in "The Realities of Language Conversions 
(2000)" http://citeseer.ist.psu.edu/terekhov00realities.html to get a 
broader idea of what is and isn't possible with a translator.

Finally I would have to say that writing a translation project in ANTLR 
is a blast!  Hands down the most interesting programs I've ever 
written.

Writing a translator is so nice because you keep refining it and if you 
discover a better way to do a particular translation you implement it 
and voila, it's in all your translated code.  As opposed to discovering 
halfway through a manual translation and realizing you have 200K lines 
to scour and fix.

I recommend writing mountains of tests too, if you can figure a way to 
do it to test the old and new code.  Keeps your translator honest.

I do these things for a living.  Contact me if you decide to go the 
ANTLR route.

Monty Zukowski
ANTLR Consultant
www.codetransform.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