talira

Tree-sitter

Parser generator and incremental parsing library that keeps a syntax tree up to date as a file is edited

open sourceMITfree

Tree-sitter is a parser generator tool and an incremental parsing library. It builds a concrete syntax tree for a source file and efficiently updates it as the file is edited, fast enough to parse on every keystroke in an editor and robust enough to give useful results in the presence of syntax errors. The runtime library is written in pure C with no dependencies, so it can be embedded in any application, and it has Rust and WebAssembly bindings and a command-line interface for generating and testing grammars.

Ways to install

Problems it solves

  • parse source code into a syntax tree in my editor fast enough to run on every keystroke
  • write a grammar for a new programming language and get a parser from it
  • keep a useful syntax tree of a file while it still has syntax errors in it

Features

  • incremental parsing that updates a concrete syntax tree as a file is edited
  • a parser generator for writing grammars for any programming language
  • error-tolerant parsing that still gives a useful tree with syntax errors
  • a dependency-free C runtime with Rust and WebAssembly bindings
  • a CLI for generating, testing and running grammars

Alternatives

The same job

These do what Tree-sitter does.

  1. Acorn (JavaScript parser) A tiny, fast JavaScript parser written in JavaScript

Compare Tree-sitter with the top 3