Charles Briscoe-Smith <[EMAIL PROTECTED]> writes:

> 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.  ;-)

Always a plus.

> 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.

This is, of course, until gcc *becomes* a java compiler and
supersedes our work.

>  - 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...  

Not quite, but I am putting a lot of time into it, so I should have
something releasable reasonably soon.  

> 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 ]

I'm always looking for good code to copy ideas from.  I'll take a
look.

> 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).

Agreed.  For code generation I'm using the gnu.bytecode package which
does a lot of the dirty work.  I'm postponing all but the simplest of
optimizations for now; my main goal is to have a working compiler
pretty soon.

> Oh, and you wouldn't have mentioned it here unless you were intending
> to make it free, would you?  ;-)

I will release it under the GPL (RSN).

-- 
Geoff Berry

Reply via email to