FINAL PROPOSAL: Meta-compiler for non-java code to run on the java virtual machine
Anders Björklund
anders.bjorklund at sajtopia.se
Fri Feb 29 02:26:25 PST 2008
FINAL PROPOSAL: Meta-compiler for non-java code to run on the java
virtual machine
Stig Anders Björklund
anders.bjorklund at sajtopia.se
-----------------------------------------------------------------------
I propose to implement
A meta-compiler for non-java code to run on the java virtual
machine. In addition, standard classes and interfaces needed to
promote building reusable library classes will be provided.
The project has two main goals:
1. To simplify the creation and manipulation of binary files -
in particular the java class format. Instrumentation for this
purpose is used by the meta-compiler. Parts of the
instrumentation can also be used outside of this project.
Related projects exist[1,2], but not under the SCA license as
far as I am aware.
2. To simplify and shorten the time it takes to initially port
a new language to the JVM. By using the meta-compiler and by
implementing language specific constructs as java classes, the
time to port a language to the JVM should be significantly
shortened.
Since certain features exist in a number of different
languages, a growing body of library classes can make porting
regular languages faster, given that the library classes all
implement the same interfaces.
If all library classes implement the same interfaces, a meta-
compiler can translate a syntax tree into an instance graph
created from the different library classes using a language
lookup table. These classes may also enforce language rules
such as no changing final variables or security checks for
example.
Different computer languages may use different libraries or
they can share parts. Given the potential scope of this
project, I intend to focus on a small subset in the form of a
limited language similar to BASIC, with a limited library.
Project plan:
15:th of may - library classes of a limited BASIC like
language implemented. Library supports a least one loop
format and at least addition and subtraction. Additional
functionality such as reading from the keyboard and writing to
the console are also implemented.
1:st of june - parsing of limited BASIC like source code and
transforming to invokable object graph completed. (Serializing
the object graph in this step would be very similar in
principle to final compilation.)
15:th of june - all instrumentation completed for class files.
15:th of july - meta-compiler creates fully functional .class
files with main method, from limited BASIC like source files.
The created classes can be started by typing java <ClassName>.
Demo program should accept input from keyboard, perform
computation based on input, and output the result of the
computation to the user.
---------------------------------------------------------------
This would constitute a complete implementation of the
proposal.
---------------------------------------------------------------
(Remaining time in reserve.)
If project is selected, all source code and binaries will be
available for download during and after development for the
OpenJDK community and others.
Code and binaries will be hosted at http://www.hilexed.org
(will be activated after selection)
Dependence on Sun:
This project does not depend on Sun.
Experience:
I currently work part time as java instructor and part time as
developer.
Some projects:
PassTicket Generator for z/OS - encrypted authentication.
Creation and bitlevel manipulation of authentication tokens.
Commercial project.
Parser and statistics tool for System z utilization data.
Commercial project.
HiLexed project at sourceforge.net - lexer and several
parsers: xml, ldif and limited java code parsed.
Open source.
Monaco project at sourceforge.net - remote code execution.
Client code is unaware of execution context through proxy
class.
Open source.
Impact
The project could further promote the idea of the JVM as a
multi language platform.
Copyright
This proposal in its entirety including any source code and
binaries resulting from it is hereby contributed under the
terms of the Sun Contributor Agreement
References
1. Apache Foundation - Byte Code Engineering Library
http://jakarta.apache.org/bcel/
2. Jasmin - Assembler for the JVM
http://jasmin.sourceforge.net/
More information about the challenge-discuss
mailing list