[fpc-devel] Pascal to Java compiler
Marco van de Voort
marcov at stack.nl
Thu Nov 27 16:17:20 CET 2008
In our previous episode, Thaddy said:
> I remember that the Delphi to java bytecode compiler isn't feature
> complete. I can't be: it will not be possible to compile any old delphi
> program into java byte code for several reasons. But it is possible to
> create Java bytecode with a - safe - subset of pascal syntax. It is also
> possible to use the same intermediate compiler to compile to .net/mono,
> though. It isn't possible to adapt Freepascal to write once compile
> anywhere with Java OR .Net. Both these assume restrictions that are
> simply not there in native code compilers, so you would have to work
> with one lame leg. I hope you realize that.
Besides the pure language problem, there is also the library problem. Java
and .NET are more than just a bytecode specification, there are also vast
standard libraries, and the VCL-alike standard libraries of FPC (classes
unit etc) are not designed to work on top of Java or .NET classes.
So then you get a problem, what do you do? Keep it compatible with native,
but a bit alien to the Java or .NET world, or re-spin the libraries in a
more Java/.NET compatible way, building on top of the base libs. Also for
this a lot of language extensions must be implemented that might not be
elegantly back-portable to native, since their philosophies are not the
But if you do such step, you introduce such a big barrier to actually
switching between native and bytecode worlds (and probably between .NET and
Java too) that one must ask what the benefit of long term keeping it in the
same project really is. Since the native and bytecode targets basically then
only share the base parser and semantic analysis.
This friction probably lead to the demise of VCL.NET and shared source on
the Borland side.
As soon as you get the pure language part working, the users will fragment
over mostly native and mostly bytecode oriented, and the common ground is
Forking a project is a big deal, but IMHO warranted in this case. If even
Borland can't pull it off.....
More information about the fpc-devel