Welcome to the home page for jacc: just another compiler compiler for Java!
Last Updated: April 24, 2004

Brought to you by: Mark P Jones in the Department of Computer Science and Engineering at the OGI School of Science & Engineering at OHSU. (And now in the Department of Computer Science at Portland State University.)


Overview

jacc is a parser generator for Java. But there are already several other parser generators for Java, including CUP, Antlr, JavaCC, SableCC, Coco/R, BYACC/Java, and the Jikes Parser Generator. So why would somebody write yet another one, and why might you want to use it?

In short, what makes jacc different from other tools is its combination of the following features:

  • Close syntactic compatibility with Johnson's classic yacc parser generator for C (in so far as is possible given that the two tools target different languages);

  • Semantic compatibility with yacc: jacc generates bottom-up/shift-reduce parsers for LALR(1) grammars with disambiguating rules;

  • Implemented in pure Java, so it is portable and runs on many Java development platforms;

  • Modest additions to help users understand and debug generated parsers, including: a feature for tracing parser behavior on sample inputs, HTML output, and tests for LR(0) and SLR(1) conflicts;

  • Primitive support for distributing grammar descriptions across multiple files to support modular construction or extension of parsers;

  • A mechanism for generating syntax error messages from examples based on ideas described by Clinton Jeffery;

  • Generated parsers that use a technique described by Bhamidipaty and Proebsting for creating very fast yacc-compatible parsers by generating code instead of encoding the specifics of a particular parser in a set of tables as the classic yacc implementations normally do.

So, if you are looking for a yacc-compatible parser generator for Java, then perhaps jacc may meet your needs!

Downloads

The following resources are available from this page:

  • A preliminary reference manual and user guide is available in pdf format.

  • Download the binary package for jacc in either zip format for Windows or tar.gz format for Unix. The two files have the same content, differing only in the conventions that they use for end of line character sequences. The README file in this package gives instructions for installation.

  • Sample programs, mostly from the jacc manual, including:

    simpleCalc.jacc:
    the simple calculator
    Calc.jacc:
    the multiple class version of the calculator program
    Unary.jacc:
    extensions to Calc.jacc to support unary minus
    example1 and example2:
    sample inputs for the calculator parser with the -r option
    Calc.errs and MoreCalc.errs:
    sample error productions for the calculator program
    dang.jacc and dang.ex:
    A grammar and example for the classic "dangling else" problem. Run this example using jacc -pt dang.jacc -r dang.ex.

History

jacc was written by Mark P Jones at the end of 1999 for use in his class on compiler construction at the beginning of 2000. It has been used in several different classes and projects since then, but has not yet been widely distributed. Comments and suggestions that might help to improve either the tool or the documentation are always welcome!

License

Unfortunately, the sources for jacc are not currently available (approval for open source distribution is still pending); the following paragraph was written to describe the expected distribution conditions once approval has been obtained: [jacc is distributed as open source software under a BSD-style license. Please let me know if you find this software useful; with your encouragement and support, it will be easier for us to release other projects under similarly open licenses!]


For more information, please contact mpj@cs.pdx.edu.