# Tree-sitter

> A fast tool that turns code into a tree of parts. It keeps up as you type.

**Field:** Software Development  
**Category:** Code Intelligence  
**Also known as:** Tree-sitter Parser, Tree Sitter, Incremental Parser

## Think of it like

It is like a quick reader. Change one word, and it redraws the plan of the story.

## Definition

Tree-sitter is a free tool that turns source code into a syntax tree, fast. It can build parsers for many languages from a grammar file. When you edit a file, it updates only the part of the tree that changed. It still gives a useful tree when the code has errors in it. Editors use it for colouring code, and code intelligence tools use it to find symbols.

## Example

An editor uses Tree-sitter to colour a Python file. Each key Lucy presses updates the tree at once.

## Why it matters

One parser library covers hundreds of languages. Tools can read code in all of them the same way.

## Common mistake

Expecting it to know types or where names point. It sees the shape of the code, not its meaning across files.

## Three principles

- **Syntax tree.** Code becomes a tree of parts.
- **Incremental.** Only the changed part is redone.
- **Error tolerant.** Broken code still parses.

## Related terms

- [Abstract Syntax Tree (AST)](https://learn.benibix.com/term/development/abstract-syntax-tree)
- [Parser](https://learn.benibix.com/term/development/parser)
- [Symbol (Programming)](https://learn.benibix.com/term/development/code-symbol)
- [Code Index](https://learn.benibix.com/term/development/code-index)
- [Syntax Error](https://learn.benibix.com/term/development/syntax-error)

## Told apart from

- [Tree-sitter vs Language Server](https://learn.benibix.com/compare/tree-sitter-vs-language-server-protocol): People think Tree-sitter and a language server do the same job in an editor, and they do not. Tree-sitter reads the shape of one file, fast, and it is used to colour and fold code. A language server knows what names mean across the whole project. It powers go to definition, rename and error hints. Most editors use both, side by side.

![A pipeline from left to right. Source files go into a parser, which builds a syntax tree for each file. From the trees, the symbols are pulled out: functions, classes and variables, each with its file and line. They are stored in a code index, lit up. Four users read from the index: go to definition, find all references, code search and an AI agent.](https://learn.benibix.com/diagrams/dev4-code-intel.svg)

---

Source: https://learn.benibix.com/term/development/tree-sitter
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
