In computer science
, an abstract syntax tree
(AST), or just syntax tree
, is a tree
representation of the syntax
of some source code
(that has been written in a programming language
). Each node of the tree denotes a construct occurring in the source code. The tree is abstract
in the sense that it may not represent some constructs that appear in the original source. For instance, the classic example of such an omission is grouping parentheses
, since in an AST the grouping of operands
is implicit in the tree structure.
An AST is often built by a parser as part of the processing of compiling source code. Once built additional information is added to the AST by subsequent processing, eg semantic analysis.