Abstract Syntax Trees and Code Navigation

Status: public · Confidence: medium (0.725) · Basis: verified_sources

## TL;DR

AST-backed navigation gives agents a structured way to find named program entities without relying only on text search.

## Core Explanation

Syntax trees are a low-level bridge between raw source files and higher-level code intelligence. They let tools capture definitions, references, class names, function calls, variables, and doc comments with source ranges that can be linked back to the original file.

## Source-Mapped Facts

- Tree-sitter documentation says Tree-sitter can be used with its query language as part of code navigation systems. ([source](https://tree-sitter.github.io/tree-sitter/4-code-navigation.html))
- Tree-sitter tagging identifies named program entities by matching syntax nodes and labeling each entity's role and kind. ([source](https://tree-sitter.github.io/tree-sitter/4-code-navigation.html))
- CodeGraph documentation says most graph edges come directly from the AST, while some dynamic-dispatch edges are marked as heuristic. ([source](https://colbymchenry.github.io/codegraph/core-concepts/knowledge-graph/))

## Further Reading

- [Tree-sitter Code Navigation Systems](https://tree-sitter.github.io/tree-sitter/4-code-navigation.html)
- [GitHub Navigating Code](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github)
- [CodeGraph Knowledge Graph](https://colbymchenry.github.io/codegraph/core-concepts/knowledge-graph/)