BSc 2nd year mini-project
one partial circle and three smaller circles in various shades of blue one blue circle

Java-- compiler

For my second second year mini-project I created a compiler that compiles a subset of the Java language (with some minor modifications) to Java byte codes executable on a Java Virtual Machine. The catch is that it only uses a procedural subset of the byte codes so that it is similar to compiling to assembly code with no classes, objects, method calls etc. This means that the compiler must compile object oriented features such as polymorphism and virtual method dispatch into simple instructions. The project was graded A+.

The compiler uses the JFlex and CUP tools to lex and parse the input respectively and the Jasmin assembler to assemble Jasmin assembly code to JVM byte code.

There was a nifty JSP/servlet web interface, but I have nowhere to host it at the moment.

Project report
Language details and grammar
Download source, classes and docs (430k)
Download command line compiler (194k)

one blue circle