Tree-sitter is a parser generator and incremental parsing library used by editors, linters, and other developer tools that need an up-to-date syntax tree of a source file as it's being edited. It's aimed at people building language tooling (editor plugins, syntax highlighters, static analyzers, code navigation features) rather than end users writing application code.
The core parsing engine is written in pure C with no external dependencies, so it can be embedded almost anywhere. Language grammars are written in a declarative DSL and compiled into standalone C parsers, which are then consumed through bindings in Rust, WebAssembly, or other host languages. Tree-sitter is the engine behind syntax highlighting and code folding in editors like Neovim, Atom, and many others.
Tree-sitter fits well when you're building an editor feature, IDE extension, or code-analysis tool that needs a live, structured view of source code: syntax highlighting, code folding, structural selection, symbol navigation, or refactoring tools. It's also a good base for static analysis and linting tools that need to walk a real syntax tree instead of relying on regex-based heuristics.
It's a strong fit for text editors and language servers where source files are edited interactively and re-parsing must be cheap, and for projects that already have (or want to write) a grammar for a specific language.
It's not the right tool if you need a full semantic analyzer, type checker, or compiler backend. Tree-sitter produces a concrete syntax tree, not a fully resolved AST with type information or scope resolution. If you just need to parse a file once and don't care about incremental re-parsing or error recovery, a simpler dedicated parser for that specific language may be less overhead.
Tree-sitter is distributed as a runtime library plus a set of language grammars, and it can be consumed in different ways depending on your stack:
tree-sitter crate as a dependency, then use the Rust binding to load a compiled language grammar and parse source text. See the Rust binding README for API details.tree-sitter CLI (via the cli crate) to generate parsers from grammar files, run test suites against grammars, and inspect parse trees from the terminal.A typical workflow for working with a grammar looks like this once the CLI is installed:
tree-sitter generate
tree-sitter test
tree-sitter parse path/to/file
For language-specific parsers (for example a grammar for Python, JavaScript, or another language), you'd typically depend on that language's separate tree-sitter-<language> grammar package alongside the core tree-sitter runtime. Full setup details for each binding, including build requirements for the underlying C compiler toolchain, are in the linked binding READMEs and the project documentation site.