Grammar files describe a syntax of a generated compiler's target programming language and actions that should be taken against its specific constructs.
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).
[2] A metacompiler is a software development tool used mainly in the construction of compilers, translators, and interpreters for other programming languages.
This approach is often called 'semantics-based compiling', and was pioneered by Peter Mosses' Semantic Implementation System (SIS) in 1978.
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.
Metacompilers reduce the task of writing compilers by automating the aspects that are the same regardless of the object language.
Command line processors, text string transforming and analysis are easily coded using metaprogramming metalanguages of metacompilers.
A full featured development package includes a linker and a run time support library.
A library consisting of support functions needed for the compiling process usually completes the full metacompiler package.
Design of the original compiler-compiler was started by Tony Brooker and Derrick Morris in 1959, with initial testing beginning in March 1962.
At roughly the same time, related work was being done by E. T. (Ned) Irons at Princeton, and Alick Glennie at the Atomic Weapons Research Establishment at Aldermaston whose "Syntax Machine" paper (declassified in 1977) inspired the META series of translator writing systems mentioned below.
[10] The other used a top-to-bottom approach based on work by Glennie to generate random English sentences from a context-free grammar.
META II, however, was written in a higher-level metalanguage able to describe its own compilation into the pseudo-machine language.
[citation needed] Roger Rutman of AC Delco developed and implemented LOGIK, a language for logical design simulation, on the IBM 7090 in January 1964.
[citation needed] Another paper in the 1964 ACM proceedings describes Meta III, developed by Schneider and Johnson at UCLA for the IBM 7090.
[17] Meta III represents an attempt to produce efficient machine code, for a large class of languages.
This effort includes powerful metacompilers, Bookl, and Book2 written in Lisp which have extensive tree-searching and backup ability.
[18] The Meta 5 system incorporates backup of the input stream and enough other facilities to parse any context-sensitive language.
Together with metacompiler of Val Schorre, it was an early inspiration for the last chapter of Donald Knuth's The Art of Computer Programming.
[19] The LOT system was developed during 1966 at Stanford Research Institute and was modeled very closely after Meta II.
The unparse rules used node recognition and attribute testing that when matched resulted in the associated action being performed.
The concept of the metamachine originally put forth by Glennie is so simple that three hardware versions have been designed and one actually implemented.
It was developed at Systems Development Corporation by Erwin Book, Dewey Val Schorre and Steven J. Sherman With the full power of (lisp 2) a list processing language optimizing algorithms could operate on syntax generated lists and trees before code generation.
Tools with broader scope, such as PQCC, Coco/R and DMS Software Reengineering Toolkit provide considerable support for more difficult post-parsing activities such as semantic analysis, code optimization and generation.
The metalanguages in the Schorre line of metacompilers are functional programming languages that use top down grammar analyzing syntax equations having embedded output transformation constructs.
is a form of logical expression consisting of tests that may be grouped, have alternates, and output productions.A long-fail is part of the backtracking system of CWIC) The character sets of these early compilers were limited.
A rule attempts to match some part of the input program source character stream returning success or failure.
TREE-META introduced tree building operators :
The syntax language is used to describe the recognition of source text and the construction from it to an intermediate tree structure.