Tree-sitter (parser generator)
{{Short description|Parser generator and library}}
{{About|the parser generator|the form of political protest|Tree sitting}}
{{Infobox software
| title = Tree-sitter
| name = Tree-sitter
| logo = Tree-sitter-small.png
| collapsible =
| author = Max Brunsfeld
| released = {{Start date and age|2018}}
| discontinued =
| latest release version = {{wikidata|property|edit|reference|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| programming language = Rust, C
| platform = Cross-platform
| size =
| genre = Parser generator
| license = MIT License
| website = {{URL|https://tree-sitter.github.io/tree-sitter/}}
}}
In computing, Tree-sitter is a parser generator and incremental parsing library.
Details
It is used to parse source code into concrete syntax trees usable in compilers, interpreters, text editors, and static analyzers.{{Cite web |title=Introductory to Treesitter |url=https://teknologiumum.com/posts/introductory-to-treesitter |access-date=2023-07-30 |website=Blog Teknologi Umum}}{{Cite web| last = Petersen| first = Mickey| title = How to Get Started with Tree-Sitter| work = Mastering Emacs| accessdate = 2023-10-30| url = https://www.masteringemacs.org/article/how-to-get-started-tree-sitter}} It is specialized for use in text editors, as it supports incremental parsing for updating parse trees while code is edited in real time,{{Cite web |title=TreeSitter - the holy grail of parsing source code |url=https://symflower.com/en/company/blog/2023/parsing-code-with-tree-sitter/ |access-date=2023-07-30 |website=symflower.com |language=en}} and provides a built-in S-expression query system for analyzing code.{{Cite web |last=Petersen |first=Mickey |title=Tree Sitter and the Complications of Parsing Languages |url=https://www.masteringemacs.org/article/tree-sitter-complications-of-parsing-languages |access-date=2023-07-30 |website=Mastering Emacs |language=en}}
Text editors which have official integrations with Tree-sitter include Atom, GNU Emacs,{{Cite web |title=GNU Emacs NEWS -- history of user-visible changes. |url=https://www.gnu.org/savannah-checkouts/gnu/emacs/news/NEWS.29.1}} Neovim,{{Cite web |title=Treesitter - Neovim docs |url=https://neovim.io/doc/user/treesitter.html |access-date=2023-07-30 |website=neovim.io}} Lapce,{{Cite web |title=lapce/CHANGELOG.md at f4747fbd306a4b8fda6927e37593bf23f4a1584b · lapce/lapce |url=https://github.com/lapce/lapce/blob/f4747fbd306a4b8fda6927e37593bf23f4a1584b/CHANGELOG.md |access-date=2023-07-30 |website=GitHub |language=en}} Zed,{{Cite web |title=Zed - Code at the speed of thought |url=https://zed.dev/ |access-date=2023-07-30 |website=Zed}} and Helix.{{Cite web |title=Helix |url=https://helix-editor.com/news/release-22-03-highlights/ |access-date=2023-07-30 |website=helix-editor.com}} Language bindings allow it to be used from programming languages including Go, Haskell, Java, JavaScript (with Node.js and WASM), Kotlin, Lua, OCaml, Perl, Python, Ruby, Rust, and Swift. Tree-sitter parsers have been written for these languages and many others.{{Cite web |title=Tree-sitter|Introduction |url=https://tree-sitter.github.io/tree-sitter/ |access-date=2023-07-30 |website=tree-sitter.github.io}} GitHub uses Tree-sitter to support in-browser symbolic code navigation in Git repositories.{{Cite journal |last1=Clem |first1=Timothy |last2=Thomson |first2=Patrick |date=2021-08-31 |title=Static Analysis at GitHub: An experience report |journal=Queue |language=en |volume=19 |issue=4 |pages=42–67 |doi=10.1145/3487019.3487022 |s2cid=238412787 |issn=1542-7730|doi-access=free }}
Tree-sitter uses a GLR parser, a type of LR parser.{{Cite web |last=Nadeem |first=Ayman |date=2020-08-04 |title=CodeGen: Semantic's improved language support system |url=https://github.blog/2020-08-04-codegen-semantics-improved-language-support-system/ |access-date=2023-07-30 |website=The GitHub Blog |language=en-US}}{{Citation |title="Tree-sitter - a new parsing system for programming tools" by Max Brunsfeld | date=14 October 2018 |url=https://www.youtube.com/watch?v=Jes3bD6P0To |access-date=2023-07-30 |language=en}}. See 22:30 for Wagner influence and 29:27 for GLR implementation.
Tree-sitter was originally developed by GitHub for use in the Atom text editor, where it was first released in 2018.{{Cite web| last = Krill| first = Paul| title = What's new in GitHub's Atom text editor| work = InfoWorld| accessdate = 2023-10-30| date = 2018-03-16| url = https://www.infoworld.com/article/3263904/whats-new-in-githubs-atom-text-editor.html}}{{Cite web |last=Brunsfeld |first=Max |date=2018-10-31 |title=Atom understands your code better than ever before |url=https://github.blog/2018-10-31-atoms-new-parsing-system/ |access-date=2023-07-30 |website=The GitHub Blog |language=en-US}}
See also
References
{{reflist}}
External links
- {{Official website|https://tree-sitter.github.io/tree-sitter/}}
- {{GitHub|tree-sitter/tree-sitter}}