[fpc-devel] Pascal to Java compiler
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Thu Nov 27 14:37:21 CET 2008
Hello,
For the compilers project from my graduation my group managed to get a
very simple pascal compiler developed with Free Pascal and generating
Java assembler, which is assembled by Jasmin.
When I started it I was thinking about phones which only run Java, and
also other phones in general. The only Pascal compiler for J2ME that I
know of is MIDLetPascal which seams abandoned. Out of simplicity to
test I generated software for J2SE, and the software generated operate
in a command line to make testing easier, but from what I've read J2ME
is very similar. It should be the same, except for the fact that a
different library is used.
My experience was very positive. The Jasmin assembler is excelent, and
very easy to use, or at least much easier then any assembler I ever
used. One drawback of Jasmin is that it doesn't generate very
meaningfull error messages. The JVM is stack based and not register
based. I managed to create integer and string type variables,
comunicate with terminal, do some basic I/O.
Unfortunatelly I suspect that code sharing with desktop PCs would be
very hard, because it's impossible to have pointers. This gives to
some doubts about if FPC could be ported to generate Java bytecode.
The files are here:
http://p-tools.svn.sourceforge.net/viewvc/p-tools/fpjava/
All reports and comments are in portuguese. But it should be easy to
figure out what every part does.
The existing compiler there should be regarded as anything nearly
ready for production, just a very initial prototype. Also note that
our professor didn't allow us to use compiler creation tools, like
plex and pyacc, so the code is larger then necessary.
I don't have a real need at the moment to expand the project into
something for production, but I thougth it would be interresting to
comment nevertheless.
bye,
--
Felipe Monteiro de Carvalho
More information about the fpc-devel
mailing list