Compiler-compiler: Difference between revisions

Content deleted Content added
Undid revision 1186519770 by CarterFendley (talk) WP:FAITH
top: expand a bit
Line 8:
The most common type of compiler-compiler is called a '''parser generator'''.<ref>{{cite book |url=https://www.worldcat.org/oclc/70775643 |title=Compilers : principles, techniques, & tools |date=2007 |others=Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Alfred V. Aho |isbn=978-0-321-48681-3 |edition=Second |___location=Boston |page=287 |oclc=70775643}}</ref> It handles only syntactic analysis.
 
A formal description of a language is usually a [[formal grammar|grammar]] file is suppliedused as thean input forto a parser generator. ThisIt is typically writtenoften inresembles [[Backus–Naur form]] (BNF) or [[extended Backus–Naur form]] (EBNF) andor defineshas theits own syntax. Grammar files describe a [[Syntax (programming languages)|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).