Abstract syntax tree

This is an old revision of this page, as edited by 83.250.196.61 (talk) at 19:36, 16 August 2005 (Clarifying the definition of an AST.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer science, an abstract syntax tree (AST) is a finite, labeled, directed tree, where the nodes are labeled by operators, and the edges represent the operands of the node operators. Thus, the leaves have nullary operators, i.e., variables or constants. In computing, it is used in a parser as an intermediate between a parse tree and a data structure, the latter which is often used as a compiler or interpreter's internal representation of a computer program while it is being optimized and from which code generation is performed. The range of all possible such structures is described by the abstract syntax.

Sometimes the code behind abstract syntax trees (classes, for example) is generated by a parser generator, but many language engineers prefer to design and implement the tree themselves, as it expresses the fundamental structure of the language.

See also

References

This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.