Welcome to the home page for jacc: just another
compiler compiler for Java!
Last Updated: November 3, 2016 (previous update: April 24, 2004)
NOTE: source code and other materials for jacc
are now available as open source software under the GPL from
github.
Brought to you by:
Mark P Jones 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
Current source code and other materials for jacc are available from
github.
The following resources are also 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 a
class on compiler construction at the Oregon Graduate Institute (OGI)
at the beginning of 2000. It has been used in several different
classes and projects since then. Comments and suggestions that
might help to improve either the tool or the documentation are
always welcome!
For more information, please contact
mpj@pdx.edu.
|