>Wes Biggs <[EMAIL PROTECTED]> writes:
>> On second thought: Should classpath be providing a written-in-java javac
>> implementation as well [...]

Geoff Berry <[EMAIL PROTECTED]> wrote:
>Glad you asked; I am working on a java compiler written in java.

Aha!  An opportunity to publicise my program.  ;-)

Since about April, I've been working on BOCK ("Bootstrap-Only Compiler
Kit").  It's also a Java compiler, written in C and targeting C.  I had
two aims in writing it:

 - It should contain everything (including mini class library) needed to
   convert the source code for a Java compiler to an file of equivalent
   C source code.  The idea is that it should be possible to use BOCK
   and GCC to bootstrap a Java compiler from a C-only environment.

 - It would be a prototype; I would be under no real pressure to make
   it good.  As I've been cleaning up the loose ends recently, I have
   been finding lots of things that I could have done better.  When I
   come to write the real compiler, I should be able to do it well.

As you can see from this, I was intending to write the "real" compiler
myself, but if you've already done it...  BOCK should still be useful
to people who don't like pre-compiled binaries, to bootstrap other Java
compilers, such as yours, from C.

And in fact BOCK is already quite useful in its own right.  You have to
be a bit careful to stay within the Java 1.0 subset that BOCK supports,
but that subset has been growing, and it's now only marginally smaller
than the language the JLS defines.  (The main points are: don't
use float or double literals, don't use labels in break or continue
statements, and put square brackets denoting array depth next to the
type name in declarations, not after the identifier (this last one I'm
currently working on fixing).)  Also, it has no access control, does
little compile-time error checking, and does not support threading
or finalisation.  All the good stuff -- exceptions, virtual method
invocation, interfaces, static initialisers -- all work.

[ If you're interested, BOCK can currently be had from
  ftp://ftp.debian.org/pub/debian/dists/unstable/main/
                                                source/devel/bock_0.14.tar.gz ]

>About half the work is done so far (it now generates ASTs), and progress
>is coming along nicely [...]  I hope to have a preliminary release in
>about a months time.

Sounds good.  I don't want to discourage you, but I think you'll find
that optimisation and code generation are bigger jobs than building a
parse tree (they were in BOCK, which doesn't even do any optimisation).
Oh, and you wouldn't have mentioned it here unless you were intending
to make it free, would you?  ;-)

Cheers,

-- 
Charles Briscoe-Smith
White pages entry, with PGP key: <URL:http://alethea.ukc.ac.uk/wp?95cpb4>
PGP public keyprint: 74 68 AB 2E 1C 60 22 94  B8 21 2D 01 DE 66 13 E2

Reply via email to