The Bantam Java compiler infrastructure is for use in teaching compiler construction. Bantam Java includes both a language and compiler, the latter of which must be completed by the student. The Bantam Java language is a "small" subset of Java as the name implies. Interestingly, Bantam is also a city in the north of the Indonesian island of Java. Although "small," Bantam Java is sufficiently practical that many (text-based) Java applications can be written in it. The infrastructure includes documentation, assignments, and code, for both students and instructors, which are linked below.
Customizability. The Bantam Java toolset is customizable in several ways. First, the toolset supports three targets: MIPS/SPIM (an emulated target), x86/Linux (a native target), and the Java Virtual Machine. Instructors can have students implement a code generator for any of these three targets. The toolset also supports two sets of lexer and parser generators. Instructors can use JLex to generate the lexer and Java Cup to generate the parser (a bottom-up parser), or JavaCC to generate both the lexer and parser (a top-down parser). There are also two installation packages for instructors to choose from: one using the make utility and another using the Apache ant tool. The toolset also includes some optional assignments (a Bantam Java optimizer and interpreter), which instructors can incorporate into their courses. Finally, instructors can choose between two versions of the Bantam Java language: a base language, which includes a small set of core Java features where the emphasis was on object-oriented features, or an extended language, which includes the base language features plus some additional features.
Base language versus extended language. Our goal in designing the base language was to build a language that was representative of Java, captured many of Java's object-oriented features (since students often have difficulty understanding how these work and especially how they are implemented), and, most importantly, whose compiler was doable in a one semester course. Some useful features were left out of the base language to ensure the compiler could be completed in a one semester course. We added some of these features to the extended language, which was designed for a more ambitious compiler course. These features include single-dimensional arrays, for loops, unlabeled break statements, prefix and postfix increment/decrement operators (++,--), and arbitrary placement of return statements.
Documentation. This project is well documented and includes a comprehensive lab manual, a compressed description of this work that was published in SIGCSE 2008, an online bulletin board for posting questions/comments/requests, the API for the compiler, and a README describing the changes made in the most recent version. These are all linked below. There are two versions of the lab manual as well as two versions of the project code: one that uses the Bantam Java base language and one that uses the Bantam Java extended language. There are four versions of the compiler API: one for each version of the language (base or extended) and each set of lexer/parser generators (JLex/Java Cup or JavaCC). Make sure that you select the appropriate version of each.
Questions. If you have any questions or suggestions, please send email to the contact address at the bottom of the page.
Base language version (pdf)
Extended language version (pdf)
SIGCSE 2008 paper (pdf)
SIGCSE 2008 presentation: 1-up pdf, 4-up pdf, ppt
CCSCNE 2010 paper (pdf)
CCSCNE 2010 presentation: 1-up pdf, 4-up pdf, ppt
Base language: with JLex/Java Cup, with JavaCC
Extended language: with JLex/Java Cup, with JavaCC
README with changes made in latest version
Send email to the contact address at the bottom of the page (expect some delay as each request must be validated)
Several undergraduate students have also worked on components of this infrastructure:
Josh Davis -- Hobart and William Smith Colleges -- Interpreter -- Spring 2009
(now a Master's candidate at Cornell University)
Lex Kridler -- Hobart and William Smith Colleges -- Extended library -- Summer 2007 Lori Pietraszek -- Hobart and William Smith Colleges -- Optimizer -- Summer 2007
(now at Lockheed Martin)
Will van Steen -- Hobart and William Smith Colleges -- Java to Bantam translator -- Summer 2009 Sara Young -- Hobart and William Smith Colleges -- Garbage collector -- Summer-Fall 2009