In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code. The syntax is 'abstract' in the sense that it does not represent every detail that appears in the real syntax. For instance, grouping parentheses are implicit in the tree structure, and a syntactic construct such as an if-condition-then expression may be denoted by a single node with two branches.
This makes abstract syntax trees different from concrete syntax trees, traditionally called parse trees, which are often built by a parser as part of the source code translation and compiling process. Once built, additional information is added to the AST by subsequent processing, e.g., contextual analysis.
Abstract syntax trees are also used in program analysis and program transformation systems.
Famous quotes containing the words abstract and/or tree:
“If we take in our hand any volume; of divinity or school metaphysics, for instance; let us ask, Does it contain any abstract reasoning concerning quantity or number? No. Does it contain any experimental reasoning, concerning matter of fact and existence? No. Commit it then to flames: for it can contain nothing but sophistry and illusion.”
—David Hume (17111776)
“Books, gentlemen, are a species of men, and introduced to them you circulate in the very best society that this world can furnish, without the intolerable infliction of dressing to go into it. In your shabbiest coat and cosiest slippers you may socially chat even with the fastidious Earl of Chesterfield, and lounging under a tree enjoy the divinest intimacy with my late lord of Verulam.”
—Herman Melville (18191891)