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
- static application security testing — Analysing source code without running it to find insecure patterns, such as SQL built from user input.
- Semgrep — An open-source static analysis tool whose rules look like the code they match, with metavariables and ellipses for the parts that vary.
- bytecode — A compact, portable instruction format that a virtual machine or interpreter executes, instead of instructions for one particular processor.
- Ignition — V8's interpreter, which turns the abstract syntax tree into bytecode and runs it so code starts quickly.
- compiler — A program that translates source code a person wrote into a form a machine or runtime can execute, checking it for errors on the way.
- static application security testing — Finding security problems by reading a program's source code without running it.
Taught in
- Static Application Security Testing with Semgrep — Cloud Security & DevSecOps Engineering
- V8 Engine & JIT Pipeline: Bytecode & Turbofan — Node.js Internals & Backend Services
- Static Application Security Testing — Application Security & Threat Modeling for Engineers