tree-sitter

Incremental parsing library for building fast, resilient syntax trees

Library
Cargo
v0.27.0
27,059 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
95 /100 Excellent
Development Activity 100
Maintenance 96
Community 84
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 90
Code Quality 88
Innovation 88
Learning Curve 60

tree-sitter is a parser-generator tool and incremental parsing library that builds concrete syntax trees for source files and can efficiently re-parse just the edited portion of a file as it changes, keeping parses fast enough for keystroke-level use in editors. The Rust crate wraps the core C parsing runtime, and grammars for individual languages are distributed as separate crates (tree-sitter-language and per-language grammar crates) that plug into this shared runtime, with web-tree-sitter providing a WASM build for browser and Node use.

It is the parsing engine behind syntax highlighting, code folding, and structural editing in tools like Neovim, GitHub’s code viewer, and Zed, and its language-agnostic grammar model has made it a de facto standard for building editor tooling that needs error-tolerant, incremental parsing.

What You Get

  • A Rust Parser/Tree/Node API for parsing source text into a concrete syntax tree
  • Incremental re-parsing that only reprocesses the edited region of a document
  • A query language (S-expression based) for pattern-matching over syntax trees
  • A tree-sitter CLI (crates/cli) for generating, testing, and highlighting with grammars
  • WASM bindings (web-tree-sitter) for running grammars in the browser or Node

Common Use Cases

  • Powering syntax highlighting and code folding in an editor or IDE plugin
  • Building structural/AST-aware code search, linting, or refactoring tools
  • Implementing ‘jump to definition’ or symbol indexing features via tree queries
  • Parsing configuration or markup formats where error recovery matters (e.g. editing mid-typing)

Under The Hood

Architecture — The workspace separates concerns cleanly: lib/src holds the core C parsing runtime (lexer, GLR parser, incremental tree diffing, Unicode handling under src/unicode), lib/binding_rust exposes this runtime as safe Rust types (Parser, Tree, Node, Query), and lib/binding_web compiles the same core to WebAssembly; crates/generate implements the grammar-to-parser-table compiler, crates/highlight/crates/tags provide query-based highlighting/symbol extraction, and crates/cli ties these into the tree-sitter command-line tool. Tech Stack — A hybrid C/Rust codebase (C for the portable parsing core, Rust for bindings, CLI, and grammar tooling) built with Cargo workspaces plus optional Zig (build.zig) and CMake (CMakeLists.txt) build paths, targeting Rust edition 2024 with MSRV 1.90, and using clippy’s nursery/cargo lint groups workspace-wide. Code Quality — The project has an extensive test/ suite (grammar corpus tests, highlight tests, query tests) alongside per-crate unit tests, strict workspace-level Clippy lint configuration (denying dbg! macros, warning on nursery/cargo lints), and active CI across multiple build systems (Cargo, Zig, CMake, Swift Package Manager), reflecting its role as foundational infrastructure many tools depend on. API Design — The Rust API centers on a small set of composable types (Parser::parse, Tree::root_node, Node::child/walk, Query::matches) that map directly onto the underlying C API, keeping the FFI boundary thin; the separate query language lets consumers express highlighting/refactoring rules declaratively instead of hand-writing tree-walking code, which is a major reason it has become a shared substrate across many unrelated editor and tooling projects.

Used by 8 apps in this directory

Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 4 days ago
Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 4 days ago
C
83%
MIT

codegraph

AI Code Assistants · Developer Tools

72,201

A pre-indexed code knowledge graph that cuts AI tool calls by 58% and token costs by 16% — auto-syncing, 100% local, works with Claude Code, Cursor, Codex, and more.

View details
84
Repo Health
85
Technical
70
Dependency
Built with
C 83%
TypeScript 14%
Updated 5 days ago
Rust
93%
Other

Tabby

AI Code Assistants

33,892

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
58
Repo Health
78
Technical
61
Dependency
Built with
Rust 93%
Updated 3 months ago
Rust
79%
Apache 2.0

TensorZero

Ab Testing Experimentation · AI Development · Monitoring

11,717

TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.

View details
53
Repo Health
87
Technical
69
Dependency
Built with
Rust 79%
TypeScript 15%
Updated 3 months ago
Rust
32%
Other

Windmill

Automation · Developer Tools

18,043

Turn scripts into webhooks, workflows, and auto-generated UIs — the fastest self-hostable workflow engine, 13x faster than Airflow.

View details
91
Repo Health
82
Technical
65
Dependency
Built with
Rust 32%
TypeScript 24%
Svelte 22%
Updated 4 days ago
Rust
90%
MIT

Zeron

AI Code Assistants · Developer Tools

2,254

A native, Rust-built control plane that runs and steers Claude Code, Codex, Cursor, Devin, and other coding agents from any device, locally by default with optional CRDT-synced multi-device control.

View details
78
Repo Health
82
Technical
78
Dependency
Built with
Rust 90%
Updated 4 days ago
Rust
90%
MIT

Zeron

AI Code Assistants · Developer Tools

2,254

A native, Rust-built control plane that runs and steers Claude Code, Codex, Cursor, Devin, and other coding agents from any device, locally by default with optional CRDT-synced multi-device control.

View details
78
Repo Health
82
Technical
78
Dependency
Built with
Rust 90%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers