Re: compiling into Java

Dan Jacobs <djacobs@BlueSky.net>
11 Apr 1996 23:44:33 -0400

          From comp.compilers

Related articles
Re: compiling into Java djacobs@BlueSky.net (Dan Jacobs) (1996-04-11)
Re: compiling into Java arnold@suneast.East.Sun.COM (1996-04-11)
| List of all articles for this month |

From: Dan Jacobs <djacobs@BlueSky.net>
Newsgroups: comp.compilers
Date: 11 Apr 1996 23:44:33 -0400
Organization: Compilers Central
Keywords: Java, translator

At 03:01 PM 4/11/96 -0400, tahmed wrote:
>
>> Hi here is my question:
>> Is it possible and feasable to write a compiler/translator from one
>> language to java, in java ?
>> Has it been already done from any language in any language??
>> Thanks for the tips.
> I just saw a posting from a fellow who just developed a C++
>to Java translator. Though I don't think it was done in Java, I'd
>say it's feasible. I don't think it would be worth your while if it's
>some majorly obsolete language like.. COBOL ..


I saw that too, but it isn't and doesn't claim to be a complete C++
to Java translator. That's *not* possible for a variety of reasons.


It is possible to translate some languages to Java source code, though
getting the features to match up may be a tall order.


An overall better approach is to translate the language into Java VM.
The VM specification details every aspect of the bytecode and compiler
output file format. Tucker Taft at Intermetrics (Cambridge MA) has
actually generated Java VM for Ada-9x and I've heard of other projects
to do the same with Smalltalk, Visual Basic, and a couple dialects of
Lisp.


The big advantage of going directly to the bytecode is that you don't
have to worry about features that are absent or incompatible in Java.
You just use the bytecodes to do what you want, so long as you don't
need to do things that the VM disallows, like allowing programs to do
pointer arithmetic, and things like that.


Dan Jacobs
Tech Tonic Netsystems email: djacobs@BlueSky.net
Burlington, MA voice: (617) 273-5825


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.