Reference

bock(1)

bootstrap-only compiler for a subset of Java(tm)

NAME

bock - bootstrap-only compiler for a subset of Java(tm)

SYNOPSIS

bock [-s start-class] [-o output-file] java-file...

DESCRIPTION

BOCK reads all the java-files specified on its command line, parses them as source code in a language which is a subset of the Java(tm) language, and writes an equivalent C program as output.

Please note that BOCK is not meant as a production compiler. It is a throw-away first-attempt compiler. The second attempt, Jackal, will be written after BOCK is capable of compiling a reasonable subset of Java(tm) programs. Jackal will be written in the Java(tm) subset which BOCK can compile, resulting in a Java(tm) system which can be bootstrapped entirely from a C-only environment.

BOCK is a somewhat user-unfriendly command; it does not include the standard library automatically, and it does not compile its C output into native code automatically. For a command which does these things, see jcomp(1).

OPTIONS

-s

Specifies the name of the class whose main() function should be called when the program is run. If not specified, Test is used.

-o

Specifies which file to write generated C to. If not specified, BOCK writes compiled code to its standard output.

FILES

BOCK does not use any external files other than those specified on its command line.

There is a subset of the Java standard library in /usr/share/bock/lib/*. No extra files are needed to implement the library's native methods.

SEE ALSO

The forthcoming Jackal compiler for the Java(tm) language.

jcomp(1), /usr/doc/bock/*.

DIAGNOSTICS

If BOCK detects an error or a construct it cannot compile, it writes a message to its standard error output and terminates with a non-zero exit code. There are many errors which BOCK does not detect.

BUGS

BOCK does not implement the Java(tm) language as specified. The differences are mostly commented throughout the code. The most significant differences from Java(tm) 1.0 are:

•

Very little error checking

•

No floating point support

•

No multithreading or synchronisation

•

No labeled statements (and thus no break or continue with label)

•

Et cetera; see /usr/doc/bock/BUGS for more

Because this compiler is only intended for bootstrapping a real, self-hosted Java(tm) compiler system, I don't intend to remedy these deficiencies. BOCK does not claim to be a standards-compliant Java(tm) compiler.

AUTHOR

BOCK was written by Charles Briscoe-Smith. I own the copyright to this program and its accompanying documentation. Please see the file /usr/doc/bock/copyright for more information.

"Java", "Sun" and "Sun Microsystems" are trademarks or registered trademarks of Sun Microsystems, Inc. This program was written with reference to Gosling, Joy and Steele's "The Java Language Specification", but without reference to Sun's JDK or any other Sun Microsystems code.

This compiler may infringe on patents owned by Sun Microsystems or others, and it is certainly based on Sun copyrighted material (namely, the LALR(1) grammar from "The Java Language Specification"). According to the licence notice in the front of "The Java Language Specification", I am licenced to use such of Sun's intellectual property as is necessary to practice the Java(tm) language specification, provided that any implementation is fully compliant with the specification. I therefore make this request to Sun's legal department: please do not sue me for failing to make BOCK fully compliant. It's only a (not so) quick hack.