kick off
[mono.git] / doc / java
1 * Java
2
3         It would be interesting to support the Java language as part
4         of the Mono project.  
5
6         You have to think of Java as various pieces: Java the
7         language and Java the virtual machine.  
8
9         It is possible to compile Java to .NET, as shown by the
10         Microsoft J# compiler.   We could then allow the migration of
11         Java applications to the Mono runtime. 
12
13 ** Native compiler
14
15         Although a native compiler can be built, and probably should be
16         built using an existing compiler, a short term solution is to 
17         build a translator from Java class files to the ECMA CIL images.
18
19         This has the advantage that we can use an existing and tested
20         Java compiler to generate the code, and then we can use an automated
21         code compiler that compiles Java VM bytecodes to CIL bytecodes.
22
23 ** The translator.
24
25         It would be interesting to write a semantic translator that
26         converts java byte codes into CIL opcodes.  This is possible
27         because the Java byte codes are a subset of the CIL ones.
28
29         A semantic tree needs to be constructed (very much in the
30         spirit of what is done in mono_analize_stack in
31         <tt>mono/mono/jit/jit.c</tt>.  Once such a semantic tree is
32         constructed, we could generate the equivalent Java code.
33
34         This has a number of interesting side effects: people can
35         continue to use their existing Java compilers to compile their
36         code, and a simple tool that converts their .class files into
37         a .NET assembly can be used.
38
39 ** Libraries
40
41         We could translate the GNU Classpath libraries with the above
42         tools to provide the Java runtime required to host into the
43         Mono runtime.  Some special treatment would be required for
44         core data types like integers, arrays and strings, and of
45         course reuse where possible existing classes from .NET to make
46         them compatible.
47
48 ** JILC - Java to IL Compiler
49
50         This is an attempt to make the java bytecode available for the
51         .NET environment.
52
53         The project attempts to generate the IL code / bytecode from the
54         compiled java class files. It has reached the stage of code-generation.
55         The issues that needs to be addressed is the mapping of java objects
56         to the IL objects, eg: java.lang.String to System.String.
57
58         Gaurav Vaish and Abhaya Agarwal are currently leading this project.
59         The project is currently hosted at <a href="http://sourceforge.net/projects/jilc">SourceForge.Net</a>.
60         The official home page of the project is 
61         <a href="http://jilc.sourceforge.net">http://jilc.sourceforge.net</a>.
62