[Mono-list] Java Bytecode -> IL Bytecode Compiler
Miguel de Icaza
miguel@ximian.com
10 Jan 2002 22:30:14 -0500
Bob brings an interesting point:
> The bytecode converter would be relatively simple, but the resulting code
> would be unusable without a set of work alike java class libs built on top
> of System. Its doable, (and would be very cool) but maping the java corlib
> onto the .net corlib will take alot of work. I suggest you start a second
> project for javalib on .net. It would be very usefull by itself.
A large portion of the libraries required to run Java can just be reused
from existing class library projects (for example GNU Classpath). What
you would like to do is map things like the Java string type to the .NET
string type in some cases (to achieve for example CLS-compatibility).
Also, I like what Sergey said. You can definitely operate from the byte
codes. Indeed, just load them as an intermediate representation, and
generate code from this, rather than attempting a dumb
bytecode-to-bytecode mapping, this approach is equivalent to a real
compiler: "parse the user input into intermediate representation" (in
this case, it is the byte codes) and then "compile" the result into .NET
code.
You could use Sergey's metadata library (it is on Sergey's web page) to
read and write byte codes from C#.
A worthwhile project I believe. It would bring together two worlds.
Miguel.