Next: Direct Compilation to JVM Up: Survey of Approaches Previous: Implementation of a Language   Contents

Compilation from Source Language to Java

Compilation of the source language into Java source code is a possible approach for porting to the JVM. As was mentioned above, compilers that target Java source to the JVM are widely available. If, for every program in the source language, an equivalent program in Java were constructed automatically, then the source language would be effectively ported to the JVM.

The only real advantage to this approach is that the porter need not be concerned with the inner workings of the JVM. This minor advantage does not outweigh the two grave disadvantages. First, the port becomes immediately susceptible to changes in the Java language and its accompanying class libraries, which are more subject to change than the JVM specification. Second, the Java source language is not as expressive as JVM bytecodes. Although Java source is very close to JVM bytecodes, there are constructs (such as goto) that exist on the JVM but do not exist in Java [4].

With these disadvantages and only one minor advantage, it is not surprising that there has yet to be any language successfully ported to the JVM using this method. It should be noted, however, that one attempt was made to port Perl to the JVM in this manner. This port worked only for a very small subset of Perl. The designers of this system even note themselves that ``to provide a complete translation would require many Java classes to be written, possibly making a bytecode-to-bytecode translation more effective'' [18]. Despite that this system does support a subset of Perl, the conventional wisdom in both the Perl and JVM porting communities is that source language to Java source translation is not feasible to port more than small subsets of given languages.


Next: Direct Compilation to JVM Up: Survey of Approaches Previous: Implementation of a Language   Contents

Copyright © 2000, 2001 Bradley M. Kuhn.

Verbatim copying and distribution of this entire thesis is permitted in any medium, provided this notice is preserved.