Compiler-compiler

In computer science, a compiler-compiler or compiler generator is a programming tool that creates a parser, interpreter, or compiler from some form of formal description of a programming language and machine.

The most common type of compiler-compiler is called a parser generator.[1] It handles only syntactic analysis.

A formal description of a language is usually a grammar used as an input to a parser generator. It often resembles Backus–Naur form (BNF), extended Backus–Naur form (EBNF), or has its own syntax. Grammar files describe a syntax of a generated compiler's target programming language and actions that should be taken against its specific constructs.

Source code for a parser of the programming language is returned as the parser generator's output. This source code can then be compiled into a parser, which may be either standalone or embedded. The compiled parser then accepts the source code of the target programming language as an input and performs an action or outputs an abstract syntax tree (AST).

Parser generators do not handle the semantics of the AST, or the generation of machine code for the target machine.[2]

A metacompiler is a software development tool used mainly in the construction of compilers, translators, and interpreters for other programming languages.[3] The input to a metacompiler is a computer program written in a specialized programming metalanguage designed mainly for the purpose of constructing compilers.[3][4] The language of the compiler produced is called the object language. The minimal input producing a compiler is a metaprogram specifying the object language grammar and semantic transformations into an object program.[4][5]

  1. ^ Compilers : principles, techniques, & tools. Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Alfred V. Aho (Second ed.). Boston. 2007. p. 287. ISBN 978-0-321-48681-3. OCLC 70775643.{{cite book}}: CS1 maint: location missing publisher (link) CS1 maint: others (link)
  2. ^ "A Syntax Directed Compiler for ALGOL 60" Edgar T. Irons, Communications of the ACM Volume 4 Issue 1, Jan. 1961.
  3. ^ a b Cite error: The named reference McGraw was invoked but never defined (see the help page).
  4. ^ a b Cite error: The named reference CWIC was invoked but never defined (see the help page).
  5. ^ Cite error: The named reference TMETA was invoked but never defined (see the help page).

From Wikipedia, the free encyclopedia · View on Wikipedia

Developed by razib.in