tree-sitter-rust

A fast, incremental Rust grammar for the tree-sitter parsing library

Library
Cargo
v0.24.2
532 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
56 /100 Fair
Development Activity 44
Maintenance 20
Community 80
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
72 /100 Good
Architecture 78
Code Quality 75
Innovation 72
Learning Curve 65

tree-sitter-rust is the official Rust language grammar for tree-sitter, the incremental parsing library used by editors and developer tools to build concrete syntax trees. It defines Rust’s syntax (traits, generics, macros, lifetimes, pattern matching) in a declarative grammar that compiles to a generated C parser plus bindings for Rust, Node.js, Python, Go, and Swift.

Editors, linters, and static-analysis tools consume this grammar to parse Rust source incrementally and error-tolerantly, powering syntax highlighting, code folding, and structural navigation without invoking rustc.

What You Get

  • A complete, actively maintained Rust grammar covering traits, generics, macros, lifetimes, and async syntax
  • A generated, dependency-free C parser (parser.c) compiled from the grammar for use in any host language
  • Official bindings for Rust, Go, Node.js, Python, and Swift for embedding the grammar directly in tooling
  • Highlight and tag queries (queries/highlights.scm) mapping syntax nodes to editor highlighting categories
  • A corpus of test fixtures (test/corpus) validating grammar correctness against real Rust code samples

Common Use Cases

  • Editor syntax highlighting - power tree-sitter-based highlighting for Rust files in editors like Neovim, Helix, and Zed
  • Code navigation tooling - build ‘jump to definition’ and structural outlines by querying the parsed Rust syntax tree
  • Static analysis and linters - traverse the concrete syntax tree to implement custom Rust lint rules without invoking rustc
  • Language server implementations - use the grammar as the incremental parsing layer underneath a Rust LSP server

Under The Hood

Architecture - The grammar is authored in grammar.js as a JavaScript DSL describing Rust’s syntax rules (items, expressions, patterns, macros, lifetimes). The tree-sitter CLI compiles this into a generated, table-driven src/parser.c, with src/node-types.json describing the resulting AST node schema; a small external scanner handles a few lexical edge cases (like raw strings) that the declarative grammar can’t express directly.

Tech Stack - The grammar source is JavaScript, but the shipped artifact is generated C code with zero runtime dependencies beyond tree-sitter-language; the repo ships first-class bindings for Rust (Cargo.toml), Go (go.mod), Node.js (package.json, binding.gyp), Python (pyproject.toml, setup.py), and Swift (Package.swift).

Code Quality - Correctness is validated through a test/corpus directory of annotated Rust snippets paired with expected parse trees; CI runs across the various language bindings before each Cargo/npm/PyPI release, keeping the grammar current as Rust language features (async, GATs, etc.) evolve.

API Design - Consumers interact through a minimal surface: a single exported language constant handed to the generic tree-sitter runtime API, so there’s effectively no Rust-specific API to learn beyond tree-sitter’s own parser/query interface, keeping integration overhead low.

Used by 8 apps in this directory

TypeScript
72%
MIT

Claude Context

AI Code Assistants · Mcp

12,573

An MCP server and VS Code extension by Zilliz that turns your entire codebase into semantically searchable context for Claude Code, Cursor, and Gemini CLI, using vector embeddings and Merkle-tree change detection.

View details
46
Repo Health
71
Technical
71
Dependency
Built with
TypeScript 72%
Python 13%
JavaScript 11%
Updated 2 months ago
TypeScript
46%
Apache 2.0

claude-mem

AI Agents · AI Development · AI Memory

94,808

Give your AI coding agents persistent memory — claude-mem captures everything that happens during sessions, compresses it with AI, and surfaces the right context in every future session automatically.

View details
86
Repo Health
82
Technical
77
Dependency
Built with
TypeScript 46%
JavaScript 40%
Python 12%
Updated 5 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
TypeScript
91%
Other

GitNexus

AI Code Assistants · Developer Tools · Mcp

47,620

Index any codebase into an interactive knowledge graph and give your AI agents deep architectural context via MCP — with zero servers required.

View details
88
Repo Health
86
Technical
73
Dependency
Built with
TypeScript 91%
Updated 4 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

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