Yet Another Compiler-Compiler An LR(1) Parser Generator for Java
By David R. Tribble |
YACC/M (pronounced "yak' em"), which stands for "Yet Another Compiler-Compiler / MLR(k)", is a parser generator, sometimes also known as a compiler-compiler. It takes a grammar specification for a user-defined language as input and produces a Java source code file that implements a parser for that language. Once compiled with the appropriate user-supplied driver methods, the resulting Java program is capable of parsing and recognizing sequences of tokens comprising valid sentences in the user-defined language.
YACC/M is based on the theory of LR(k) bottom-up parsers, invented in the 1960s by Donald E Knuth. It is based in part upon the original YACC program written by Steven Johnson as part of the UNIX effort at Bell Labs in the early 1970s. YACC/M, in fact, is capable of translating most YACC source files with little or no modification. YACC/M differs from classic YACC, however, in a few important ways.
The YACC program is composed of two Java packages bundled as a single jar file.
The source code for YACC/M is copyrighted open source code. This means that although you are free to copy, use, and distribute the source code, you cannot claim it as your own creation, nor can you claim as your own any derivative works created by modifying the code.
Generated code produced as a result of running the YACC/M program, however, is not subject to any copyright restrictions. Specifically, the generated code is not copyrighted except for the parts of the code that are included in the generated code that were originally written by the user - those parts may be copyrighted by the user who originally authored them. This also means that although the source to YACC/M is open source code, any parser code produced by it is not. Such generated source code can be used (and protected) any way the user sees fit, and he is not obligated to publish or make available to anyone such generated source code.
This project is dedicated to the memory of Ed Felt, a former colleage of mine at BEA Systems, Inc. who was one of the victims of the terrorist hijacking of United Airlines Flight 93 on September 11, 2001.
A few links mentioning Ed:
The author can be reached by email at
david@tribble.com.
The author's home web page is at
david.tribble.com.
Revision: 0.3, 2002-07-11.
Copyright ©2001-2002, by David R. Tribble, all rights reserved.