Welcome to BantamJava.com
pic

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: corliss at hws dot edu.

Toolset:
Project code:
     Base language version: Make package (compressed tarball), Ant package (ZIP file)
     Extended language version: Make package (compressed tarball), Ant package (ZIP file)

Documentation:
Lab manual:
      Base language version (pdf)
      Extended language version (pdf)
Bulletin board for questions/comments/requests
SIGCSE paper (pdf)
SIGCSE presentation: 1-up pdf, 4-up pdf, ppt
Compiler API:
      Base language: with JLex/Java Cup, with JavaCC
      Extended language: with JLex/Java Cup, with JavaCC
README with changes made in latest version

Solution code:
Email the first author at corliss at hws dot edu (expect some delay as each request must be validated)

Previous versions:
Version 1.2
Version 1.1

Links to auxiliary tools:
JLex
Java Cup
JavaCC
SPIM Emulator
Jasmin Java Assembler

Staff:
This work is being undertaken by:
      Marc Corliss (Hobart and William Smith Colleges)
      David Furcy (University of Wisconsin Oshkosh)
      E Lewis (VMware, inc.)

Five undergraduate students at Hobart and William Smith Colleges have also worked on components of this infrastructure:
     Josh Davis -- Interpreter (Spring 2009)
     Lex Kridler -- Extended library (Summer 2007)
     Lori Pietraszek (now at Lookheed Martin) -- Optimizer (Summer 2007)
     Will van Steen -- Java to Bantam Java translator (Summer 2009)
     Sara Young -- Garbage collector (Summer 2009)


Contact: corliss at hws dot edu
Last modified: Tue Oct 13 11:43:56 EDT 2009