Re: C++ -> Java VM compiler

aszs@enternet.com (adam souzis)
12 Jan 1997 11:52:23 -0500

          From comp.compilers

Related articles
Re: C++ -> Java VM compiler aszs@enternet.com (1997-01-12)
Re: C++ -> Java VM compiler gah@u.washington.edu (1997-01-16)
Re: C++ -> Java VM compiler kuznetso@MIT.EDU (1997-01-17)
Why Virtual Machines? (was: C++ -> Java VM compiler) p.froehlich@link-m.de (1997-01-25)
Re: Why Virtual Machines? (was: C++ -> Java VM compiler) robison@kai.com (Arch Robison) (1997-01-29)
Re: Why Virtual Machines? (was: C++ -> Java VM compiler) albaugh@agames.com (1997-01-29)
Re: Why Virtual Machines? (was: C++ -> Java VM compiler) Bronikov@srv2.ic.net (Dmitri Bronnikov) (1997-02-02)
[4 later articles]
| List of all articles for this month |
From: aszs@enternet.com (adam souzis)
Newsgroups: comp.compilers,comp.lang.c++,comp.lang.java.misc
Date: 12 Jan 1997 11:52:23 -0500
Organization: A customer of Pacific Bell Internet Services
References: <01bbfca0$a284a6f0$041b6682@tecel>
Keywords: C++, Java, translator

zzrwatts@mailbox.uq.edu.au says...


> this is a project id love to do, if I was a robo-coder
>
> 1. create a GNU g++ description for the Java virtual machine
> 2. write a portable library abstracting the classes awt etc.
> 3. recompile your C++ app/code to a .class.....viola!
>
> any takers, or interest in this project.
> especially if you have targeted G++ to a new processor, can inform me as to
> the feasibility of the idea?


As I understand it the Java VM is sufficently constrained to make that
a challenging proposition. Some C++ constructs such as pointer
arithmetic would be impossible to express in Java byte code. Other
constructs seem difficult but could probably be resolved through
various code generation techniques (for example the compiler could be
flattened out a multiple inheritance class hierarchy similar to the
way some Lisp systems deal with multiple inheritance).


If you look at the byte-code spec for Java (available on Sun's web
site), you can see that it is pretty different from a real processor's
machine code so my guess would be that it wouldn't fit to well into
GNU's back- end. In addition the Java VM validates the .class files'
byte-code further constraining the compiler's options.


Despite the difficulties I'd love to have a tool like this. I'm sure
no matter what, I'd have to re-write tons of my C++ code to get it
working in Java, but that's still better than having rewrite all of it
(in a new language)! Does anyone know of any research into this
matter? Considering how much C/C++ code there is out there, I'd
imagine it would be make a sucessful commercial tool.


-- adam
--


Post a followup to this message

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