Jacc: (much more than) Just another compiler compiler

Hassan Aït-Kaci
© all rights reserved by the author

N.B.: The interested reader is referred to [1] for a general presentation of the programming-language design system of which Jacc is a part. The Java code for all this is made publicly available on my GitHub site.

Quick Links

What is Jacc?

At first sight, Jacc may be seen as a "100% Pure Java" implementation of an LALR(1) parser generator [2] in the fashion of the well known UNIX tool yacc---"yet another compiler compiler" [3]. Jacc is in fact much more than ... just another compiler compiler: it extends yacc to enable the generation of flexible and efficient Java-based parsers and provides enhanced functionality rarely available in other similar systems.

The fact that Jacc uses yacc's metasyntax makes it readily usable on most yacc grammar. Other Java-based parser generators all depart from yacc's format, requiring nontrivial metasyntactic preprocessing to be used on existing yacc grammars (which abound in the world, yacc being by far the most popular tool for parser generation). Importantly, Jacc is programmed in pure Java---this makes it fully portable to all existing platforms, and immediately exploitable for web-based software applications.

Jacc further stands out among other known parser generators, whether Java-based or not, thanks to several additional features. The most notable are:

Using Jacc

A grammar can be specified using the usual familiar yacc syntax with semantic actions specified as Java code. The format of the grammar file is essentially the same as that required by yacc, with some minor differences, and a few additional powerful features. Not using the additional features makes it essentially similar to the yacc format.

For instructions on how to organize a Jacc grammar, please refer to the documentation of the grammar format, or to the description of grammar commands. If you wish to use Jacc, follow these simple steps. For details on how jacc extends yacc to support Prolog-style dynamic operators, read the specification. You may also want to peruse the code of Jacc grammar examples.


For detailed explanations of most constructions and algorithms used by this package, please refer to the following.

  1. Hassan Aït-Kaci, "An Abstract, Reusable, and Extensible Programming Language Design Architecture," in In Search of Elegance in the Theory and Practice of Computation - Essays dedicated to Peter Buneman, Val Tannen, Limsoon Wong, Leonid Libkin, Wenfei Fan, Wang-Chiew Tan, Michael Fourman, Eds., Springer, September 2013.

  2. Alfred Aho, Ravi Sethi, and Jeffrey Ullman, Compilers: Principles, Techniques, and Tools. Addison-Wesley, 1986. (This text is also familarly known as The Dragon Book.)

  3. Stephen C. Johnson, "Yacc: Yet Another Compiler Compiler," Computer Science Technical Report 32. AT&T Bell Labs, Murray Hill, NJ, 1975. (Reprinted in the 4.3BSD Unix Programmer's Manual, Supplementary Documents 1, PS1:15. UC Berkeley, 1986.)

  4. Frank DeRemer, and Thomas Penello, "Efficient computation of lookahead sets", ACM Transactions of Programming Languages and Systems, 4(4), pp. 615-749 (Oct. 82).

  5. Joseph Park, K.M Choe, and C.H. Chang, "A new analysis of LALR formalisms", ACM Transactions of Programming Languages and Systems, 7(1), pp. 159-175 (Jan. 85).

  6. Kwang-Moo Choe, Personal Communication (choe@compiler.kaist.ac.kr). Korean Advanced Institute of Science and Technology, Seoul, South Korea (Dec. 2000).

Last modified on Wed Jan 08 18:21:42 2020 by hak