Cambridge
Account MaintenanceSearchView basketOrdering Help

Modern Compiler Implementation in Java, Second Edition - The MiniJava Project
 Grammar
 Programs
 Framework
 Software
 Java Reference
 MiniJava Reference

What is Mini-Java?

MiniJava is a subset of Java. The meaning of a MiniJava program is given by its meaning as a Java program. Overloading is not allowed in MiniJava. The MiniJava statement System.out.println( ... ); can only print integers. The MiniJava expression e.length only applies to expressions of type int [].

The Grammar link on the left has the formal BNF for MiniJava. You can also view some sample MiniJava programs under the Programs link. The Framework link provides a helpful interface to write a MiniJava Compiler. The software link has links to software and tools that may be helpful to write and test your compiler. The Java Reference is a helpful resource to learn the language. And the MiniJava Reference is a miniJava reference manual from the appendix of the book.

(C) MiniJava project by Joao Cangussu, Jens Palsberg and Vidyut Samanta.

Grammar

BNF for MiniJava

Sample MiniJava Programs

The following are some sample MiniJava programs that you may use to test the correctness of your compiler. All of these programs can be compiled with javac and output compared with your results.


Framework

1. Introduction
2. Lexical Analysis (readme) ...

javacc... sablecc...

3. Parsing (readme)
4. Abstract Syntax (readme) ...

handcrafted... syntaxtree...   visitor...

5. Type Checking (readme)
6. Activation Records (readme) ...

Temp... Util...

7. Translation to Intermediate Representation (readme) ...

Tree...  

8. Canonical Trees (readme) ...

Canon...  

9. Instruction Selection (readme) ...

Assem... Canon...

10. Dataflow Analysis (readme) ...

FlowGraph... Graph... RegAlloc...

11. Register Allocation (readme)
12. Putting It All Together (readme)

runtime...

Here is a sample main program that could be used to link everything together.


Software
Java Reference

The following links provide a good resource for learning Java:

MiniJava Reference

A copy of the MiniJava Reference Manual as printed on pages 484 to 486.

© 2002 Cambridge University Press