tree-sitter
An incremental parsing system used by many editors.
tree-sitter parses source code into concrete syntax trees and updates them efficiently as you type. Where regex-based syntax highlighting can only match local patterns, tree-sitter understands the language's full grammar, so highlighters can distinguish a function call from a method call, a type annotation from a variable, or a string from interpolated content inside it.
Editors use tree-sitter for syntax highlighting, structural navigation (jump to enclosing function, select inner block), indent calculation, and refactoring support. Neovim, Helix, and Atom (historically) all build on it. The query language for patterns over the syntax tree is small but expressive.
Max Brunsfeld started tree-sitter in 2018 while at Atom (later GitHub). The grammar repositories — one per language — are a collaborative effort by the broader programming-language community, with hundreds of grammars now available. The MIT licence keeps the project broadly usable.
Install
cargo install tree-sitter-cli Or via npm: npm install -g tree-sitter-cli
Authors
- Max Brunsfeld (creator)
- tree-sitter contributors