tree-sitter/docs/index.md

84 lines
4.3 KiB
Markdown
Raw Normal View History

2018-06-10 09:54:59 -07:00
---
title: Introduction
---
# Introduction
Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited. Tree-sitter aims to be:
2018-06-10 09:54:59 -07:00
* **General** enough to parse any programming language
2018-06-11 19:17:10 -07:00
* **Fast** enough to parse on every keystroke in a text editor
* **Robust** enough to provide useful results even in the presence of syntax errors
* **Dependency-free** so that the runtime library (which is written in pure C) can be embedded in any application
2018-06-10 09:54:59 -07:00
### Language Bindings
There are currently bindings that allow Tree-sitter to be used from the following languages:
* [Rust](https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_rust)
* [JavaScript (Wasm)](https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web)
* [JavaScript (Node.js)](https://github.com/tree-sitter/node-tree-sitter)
* [Python](https://github.com/tree-sitter/py-tree-sitter)
2018-06-10 09:54:59 -07:00
* [Ruby](https://github.com/tree-sitter/ruby-tree-sitter)
* [Haskell](https://github.com/tree-sitter/haskell-tree-sitter)
2018-06-10 09:54:59 -07:00
### Available Parsers
2018-06-12 17:37:46 -07:00
Parsers for these languages are fairly complete:
2018-06-10 09:54:59 -07:00
* [Bash](https://github.com/tree-sitter/tree-sitter-bash)
* [C](https://github.com/tree-sitter/tree-sitter-c)
* [C#](https://github.com/tree-sitter/tree-sitter-c-sharp)
2018-06-10 09:54:59 -07:00
* [C++](https://github.com/tree-sitter/tree-sitter-cpp)
2018-10-30 09:36:45 -07:00
* [CSS](https://github.com/tree-sitter/tree-sitter-css)
2019-05-31 13:25:14 +02:00
* [Elm](https://github.com/razzeee/tree-sitter-elm)
* [Eno](https://github.com/eno-lang/tree-sitter-eno)
2018-07-05 16:45:27 -07:00
* [ERB / EJS](https://github.com/tree-sitter/tree-sitter-embedded-template)
2020-09-01 22:34:45 -04:00
- [Fennel](https://github.com/travonted/tree-sitter-fennel)
2018-06-10 09:54:59 -07:00
* [Go](https://github.com/tree-sitter/tree-sitter-go)
2018-06-12 17:37:46 -07:00
* [HTML](https://github.com/tree-sitter/tree-sitter-html)
* [Java](https://github.com/tree-sitter/tree-sitter-java)
2018-06-10 09:54:59 -07:00
* [JavaScript](https://github.com/tree-sitter/tree-sitter-javascript)
2019-05-31 09:20:49 -07:00
* [Lua](https://github.com/Azganoth/tree-sitter-lua)
2019-09-30 20:10:37 +08:00
* [Markdown](https://github.com/ikatyang/tree-sitter-markdown)
2018-07-05 16:45:27 -07:00
* [OCaml](https://github.com/tree-sitter/tree-sitter-ocaml)
2018-06-10 09:54:59 -07:00
* [PHP](https://github.com/tree-sitter/tree-sitter-php)
* [Python](https://github.com/tree-sitter/tree-sitter-python)
* [Ruby](https://github.com/tree-sitter/tree-sitter-ruby)
* [Rust](https://github.com/tree-sitter/tree-sitter-rust)
* [SystemRDL](https://github.com/SystemRDL/tree-sitter-systemrdl)
2019-09-01 02:30:11 +08:00
* [TOML](https://github.com/ikatyang/tree-sitter-toml)
2018-06-10 09:54:59 -07:00
* [TypeScript](https://github.com/tree-sitter/tree-sitter-typescript)
* [Verilog](https://github.com/tree-sitter/tree-sitter-verilog)
2020-10-29 19:08:55 +00:00
* [VHDL](https://github.com/alemuller/tree-sitter-vhdl)
2019-10-04 20:38:01 +08:00
* [Vue](https://github.com/ikatyang/tree-sitter-vue)
2019-09-01 02:30:11 +08:00
* [YAML](https://github.com/ikatyang/tree-sitter-yaml)
* [WASM](https://github.com/wasm-lsp/tree-sitter-wasm)
2018-06-10 09:54:59 -07:00
2018-06-12 17:37:46 -07:00
Parsers for these languages are in development:
2018-06-10 09:54:59 -07:00
* [Agda](https://github.com/tree-sitter/tree-sitter-agda)
2018-06-10 09:54:59 -07:00
* [Haskell](https://github.com/tree-sitter/tree-sitter-haskell)
* [Julia](https://github.com/tree-sitter/tree-sitter-julia)
* [Nix](https://github.com/cstrahan/tree-sitter-nix)
2018-06-10 09:54:59 -07:00
* [Scala](https://github.com/tree-sitter/tree-sitter-scala)
2020-11-20 11:42:33 +01:00
* [SPARQL](https://github.com/BonaBeavis/tree-sitter-sparql)
2019-09-06 09:18:30 -07:00
* [Swift](https://github.com/tree-sitter/tree-sitter-swift)
2018-06-10 09:54:59 -07:00
### Talks on Tree-sitter
* [Strange Loop 2018](https://www.thestrangeloop.com/2018/tree-sitter---a-new-parsing-system-for-programming-tools.html)
2018-06-10 09:54:59 -07:00
* [FOSDEM 2018](https://www.youtube.com/watch?v=0CGzC_iss-8)
* [GitHub Universe 2017](https://www.youtube.com/watch?v=a1rC79DHpmY)
2018-06-11 19:17:10 -07:00
### Underlying Research
The design of Tree-sitter was greatly influenced by the following research papers:
- [Practical Algorithms for Incremental Software Development Environments](https://www2.eecs.berkeley.edu/Pubs/TechRpts/1997/CSD-97-946.pdf)
- [Context Aware Scanning for Parsing Extensible Languages](http://www.umsec.umn.edu/publications/Context-Aware-Scanning-Parsing-Extensible)
- [Efficient and Flexible Incremental Parsing](http://ftp.cs.berkeley.edu/sggs/toplas-parsing.ps)
- [Incremental Analysis of Real Programming Languages](https://pdfs.semanticscholar.org/ca69/018c29cc415820ed207d7e1d391e2da1656f.pdf)
- [Error Detection and Recovery in LR Parsers](http://what-when-how.com/compiler-writing/bottom-up-parsing-compiler-writing-part-13)
- [Error Recovery for LR Parsers](http://www.dtic.mil/dtic/tr/fulltext/u2/a043470.pdf)