Re: Possible to write compiler to Java VM? (I volunteer to summarize)

John Gough <gough@dstc.qut.edu.au>
21 Jan 1996 21:03:15 -0500

          From comp.compilers

Related articles
Possible to write compiler to Java VM? (I volunteer to summarize) seibel@sirius.com (Peter Seibel) (1996-01-17)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) bnm@indica.bbt.com (1996-01-18)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) NoeC@po1.cpi.bls.gov (1996-01-19)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) basile.starynkevitch@cea.fr (1996-01-20)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) gough@dstc.qut.edu.au (John Gough) (1996-01-21)
Possible to write compiler to Java VM? (I volunteer to summarize) fjh@cs.mu.OZ.AU (1996-01-23)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) andi@complang.tuwien.ac.at (Andreas Krall) (1996-01-23)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) boutell.com@holly.aa.net (1996-01-23)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) darius@phidani.be (Darius Blasband) (1996-01-23)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) jbuck@Synopsys.COM (1996-01-25)
Re: Possible to write compiler to Java VM? (I volunteer to summarize) anicolao@cgl.UWaterloo.CA (1996-01-25)
[5 later articles]
| List of all articles for this month |
From: John Gough <gough@dstc.qut.edu.au>
Newsgroups: comp.compilers
Date: 21 Jan 1996 21:03:15 -0500
Organization: Distributed Systems Technology Centr
References: 96-01-037
Keywords: interpreter, question

"Peter Seibel" <seibel@sirius.com> wrote:


>So I'm asking you all: how easy/hard/impossible would it be to write a
>compiler for your favorite language(s) that compiles to Java VM
>byte-codes. ...


This is a question that has answer which is obvious, simple and wrong.


On the face of it java byte codes are just the instructions of a stack
abstract machine, similar to UCode or PCode, and hence a suitable
target for most any source language. However, this view is deceptive.
The issues are: java bytecodes operands are _typed_ so that the usual
undisciplined use of pointers in C is impossible. For stricter
languages such as Modula-N, or Ada this should not be an issue. In
particular, a language such as Oberon-2 would appear to map very
naturally onto the type system of Java.


There are two additional problems which need to be solved. One is
that java programs are expected to sit on top of a set of base classes
which implement target specific stuff. If any of these base classes
require interface implementation (as well as the single inheritance
subclassing) then nothing in Oberon or Ada seems to map naturally to
this. The second thing is that a bit of trickery is required to map
multidimensional arrays in your favorite language into java's
dope-vector, all dynamic "arrays of pointers to array..."
implementation.


So, in summary: I think that a subset of most languages could use java
bytecodes as an intermediate form. However, the translation of the
whole of even suitable languages to java is challenging but not
impossible IMHO.


John Gough
Queensland University of Technology, Australia.
http://www.dstc.qut.edu.au/~gough
--


Post a followup to this message

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