abstract syntax tree

A tree-shaped description of a program's structure, with nodes for pieces such as functions, calls and assignments, that tools build from the source text.

In more detail

Compilers, linters, code formatters and security scanners all work on this tree rather than on raw text. Walking the tree lets a tool ask how a value was built, for example by following a variable back to its assignment. Many languages expose it directly, such as Python's ast module.

Example

V8 builds an abstract syntax tree while parsing, and its Ignition interpreter turns that tree into bytecode.

Related terms

Taught in

References