Architecture โ
text
tree-sitter.zig
โ
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโ
โ โ โ
Parser Tree Query
โ โ โ
โโโโโโผโโโโโ โโโโโโโผโโโโโโ โโโโโโผโโโโโ
โ โ โ โ โ โ โ โ โ
Lexer Stack Actions Node Cursor Edit Pattern Capture Matcher
โ
Input
โ
Unicode
โ
LanguageIn plain language โ
Source text flows downward: input bytes are tokenized by the lexer, assembled into a tree by the parser using language tables, and then read through nodes, cursors, or queries. Edits flow back up: an edit plus an old tree reuses subtrees to build a new tree cheaply.
Dependency direction โ
Low-level code never imports high-level code:
text
utils โ core โ memory โ input/unicode โ language โ tree โ lexer โ parser โ querycore (points, ranges, edits, symbols) knows nothing about parsing; utils is pure helpers over the standard library. Each subsystem exposes a facade (parser/parser.zig, tree/tree.zig, โฆ) re-exported by src/treesitter.zig.
