Compiler-compiler

Compiler-compiler

A compiler-compiler or compiler generator is a tool that creates a parser, interpreter, or compiler from some form of formal description of a language and machine. The earliest and still most common form of compiler-compiler is a parser generator, whose input is a grammar (usually in BNF) of a programming language, and whose generated output is the source code of a parser often used as a component of a compiler. Similarly, code generator-generators such as (JBurg) exist, but such tools have not yet reached maturity.

The ideal compiler-compiler takes a description of a programming language and a target instruction set architecture, and automatically generates a usable compiler from them. In practice, the state of the art has yet to reach this degree of sophistication and most compiler generators are not capable of handling semantic or target architecture information.

Contents

Variants

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 analyzed by the parser. Depending upon the type of parser that should be generated, these routines may construct a parse tree (or abstract syntax tree), or generate executable code directly.

One of the earliest (1964), surprisingly powerful, versions of compiler-compilers is MetaII, which accepted grammars and code generation rules, and is able to compile itself and other languages.

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 1978.[1] 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 project at Carnegie-Mellon University does not formalize semantics, but does have a semi-formal framework for machine description.

Compiler-compilers exist in many flavors, including bottom-up rewrite machine generators (see JBurg) used to tile syntax trees according to a rewrite grammar for code generation, and attribute grammar parser generators (e.g. ANTLR can be used for simultaneous type checking, constant propagation, and more during the parsing stage).

History

The first compiler-compiler to use that name was written by Tony Brooker in 1960 and was used to create compilers for the Atlas computer at the University of Manchester, including the Atlas Autocode compiler. However it was rather different from modern compiler-compilers, and today would probably be described as being somewhere between a highly customisable generic compiler and an extensible-syntax language. The name 'compiler-compiler' was far more appropriate for Brooker's system than it is for most modern compiler-compilers, which are more accurately described as parser generators. It is almost certain that the "Compiler Compiler" name has entered common use due to Yacc rather than Brooker's work being remembered.[citation needed]

Other examples of parser generators in the yacc vein are ANTLR, Coco/R, CUP, GNU bison, Eli, FSL, SableCC and JavaCC.

Several compiler-compilers

  • ANTLR
  • Bison
  • Coco/R
  • ELI, an integrated toolset for compiler construction.
  • Lemon
  • parboiled, a Java library for building parsers.
  • Packrat parser
  • PQCC, a compiler-compiler that is more than a parser generator.
  • VisualLangLab, a visual parser generator for JVM languages.
  • Yacc

Other related topics

Notes

  1. ^ Peter Mosses, "SIS: A Compiler-Generator System Using Denotational Semantics," Report 78-4-3, Dept. of Computer Science, University of Aarhus, Denmark, June 1978

References

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.

Further reading

Historical

  • Brooker, R. A., et al., The Compiler-Compiler, Annual Review in Automatic Programming, Vol. 3, p. 229. (1963).
  • Brooker, R. A., Morris, D. and Rohl, J. S., Experience with the Compiler Compiler, Computer Journal, Vol. 9, p. 350. (February 1967).
  • Johnson, Stephen C., Yacc—yet another compiler-compiler, Computer Science Technical Report 32, Bell Laboratories, Murray Hill, NJ, July 1975
  • McKeeman, William Marshall; Horning, James J.; Wortman, David B., CS.toronto.edu, A Compiler Generator, Englewood Cliffs, N.J.: Prentice-Hall, 1970. ISBN 0-13-155077-2

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Compiler optimization — is the process of tuning the output of a compiler to minimize or maximize some attributes of an executable computer program. The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the… …   Wikipedia

  • Compiler construction — is an area of computer science that deals with the theory and practice of developing programming languages and their associated compilers. The theoretical portion is primarily concerned with syntax, grammar and semantics of programming languages …   Wikipedia

  • compiler — [ kɔ̃pile ] v. tr. <conjug. : 1> • 1190; lat. compilare, de pilare « piller » 1 ♦ Didact. Mettre ensemble (des extraits, des documents) pour former un recueil. Compiler des documents. 2 ♦ Péj. Plagier. 3 ♦ Anglic. Inform. Traduire (un… …   Encyclopédie Universelle

  • Compiler (anime) — Compiler コンパイラ Genre Science fiction Manga Written by Kia Asamiya Published by …   Wikipedia

  • Compiler — コンパイラ (Compáira) Género Ciencia Ficción, Comedia, Seinen Manga Creado por Kia Asamiya …   Wikipedia Español

  • Compiler Description Language — Compiler Description Language, or CDL, is a Computer language based on affix grammars. It is very similar to Backus–Naur form(BNF) notation. It was designed for the development of compilers. It is very limited in its capabilities and control… …   Wikipedia

  • Compiler Compiler — Compiler Compiler,   Meta Compiler …   Universal-Lexikon

  • Compiler-Sprache — Compiler Sprache,   eine Programmiersprache, bei der der Quellcode durch einen Compiler in Maschinencode übersetzt (kompiliert) werden muss, bevor das Programm ausgeführt werden kann. Typische Compiler Sprachen sind Pascal und C. Im Gegensatz… …   Universal-Lexikon

  • Compiler-Basic — Compiler Basic,   eine Version der Programmiersprache Basic, bei der mit dieser Sprache erstellte Programme kompiliert (Compiler) werden müssen, bevor sie ausgeführt werden können. Das normale Basic ist dagegen eine Interpreter Sprache, d. h.… …   Universal-Lexikon

  • compiler — com‧pil‧er [kəmˈpaɪlə ǁ ər] noun [countable] 1. a person who collects information together and writes it into a list, report, book etc 2. COMPUTING a computer program or piece of software that changes another program from its existing format into …   Financial and business terms

  • Compiler-Direktive — Compiler Direktive,   eine Metaanweisung an den Compiler …   Universal-Lexikon

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”