[antlr-interest] ANTLR3 Converting Java to C++ subset (sorta)

Kailey Joanette kaileyjo at bigbluebubble.com
Tue Mar 27 06:38:34 PDT 2007


"However, if you know the exact programs which are to be translated then you
might not need to handle all the cases."

 

If only. this is supposed to be a general tool that can always be used to
translate for us.  This will be the 3rd representation and attempt at
translation now.  The first time I was going to use JavaCC.which turned out
to be bulky and ugly.  ANTLR seems to have all the abilities I need but now
people (ie: you) are telling me that it makes more sense to use something
like the JDT stuff with Eclipse. though I know language translation can be
done with ANTLR.  It's a very confusing mess.

 

I would like to make it clear that I'm not translating incredibly complex
programs.  I am usually the one that is doing all these conversions by hand
and I can tell you that about 80% of everything translates almost directly
into J2ME with very little effort.  The most obvious of these changes are
changing accessors from '.' To '->' or '::', moving array definition
brackets around, and making pointers out of almost all non primitive types.
This I guess is why I chose ANTLR in the first place.  Which is why I keep
wondering if I should just ignore the tree altogether and see what happens.
Unfortunately, and obviously, this wouldn't be as robust as we would like,
since if ever we change our coding styles it could very well break the tool.

 

Also, with the JDT stuff from Eclipse, won't it start getting confused once
I start translating code to C++?  Since all of the code parsing structures
depend on the code being well formed Java syntax?

Kailey 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070327/98bc345c/attachment.html 


More information about the antlr-interest mailing list