An abstract syntax tree (AST) is a tree representation of the structure of source code, used by compilers, linters, and code analysis tools to understand program logic without executing it. Each node in the tree represents a construct in the source code: a function declaration, a loop, a variable assignment.
ASTs are relevant to AI coding tools because they enable structural understanding of code beyond raw text. An agent with AST awareness can reason about code structure, identify dependencies, and make changes that respect the syntactic rules of the language.
Some code analysis tools use AST parsing to provide AI agents with more precise context about the codebase than simple text embedding.
