A compiler-compiler or compiler generator is a program that generates the source code of a parser, interpreter, or compiler from a programming language description. In the most general case, it takes a full syntactic and semantic description of a programming language, along with a full description of a target instruction set architecture, and generates a compiler.
The earliest and still most common form of compiler-compiler is a parser generator, whose input is a grammar (usually in BNF) of the language. A typical parser generator associates executable code with each of the rules of the grammar that should be executed when these rules are applied by the parser. These pieces of code are sometimes referred to as semantic action routines since they define the semantics of the syntactic structure that is analysed by the parser. Depending upon the type of parser that should be generated, these routines may construct a parse tree (or AST), or generate executable code directly.
Some experimental compiler-compilers take as input a formal description of programming language semantics, typically using denotational semantics. This approach is often called 'semantics-based compiling', and was pioneered by Peter Mosses' Semantic Implementation System (SIS) in 1979. However, both the generated compiler and the code it produced were inefficient in time and space. No production compilers are currently built in this way, but research continues.
The Production Quality Compiler-Compiler (PQCC) project at Carnegie-Mellon University does not formalize semantics, but does have a semi-formal framework for machine description.
Other examples of parser generators in the yacc vein are ANTLR, Coco/R, CUP, GNU bison, Eli, FSL, META 5, MUG2, Parsley, Pre-cc, SableCC, JavaCC and MixedCC.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Compiler-compiler".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world