Software:Tree-sitter (parser generator)

From HandWiki
Tree-sitter
Tree-sitter-small.png
Original author(s)Max Brunsfeld
Initial release2018; 6 years ago (2018)
Stable release
0.20.8 / 4 April 2023
Written inRust, C
PlatformCross-platform
TypeParser generator
LicenseMIT License
Websitetree-sitter.github.io/tree-sitter/

In computing, Tree-sitter is a parser generator and incremental parsing library. It is used to parse source code into parse trees usable in compilers, interpreters, text editors, and static analyzers.[1] It is specialized for use in text editors, as it supports incremental parsing for efficiently updating parse trees while code is edited in real time,[2] and provides a built-in S-expression query system for analyzing code.[3] It has no dependencies, allowing its library to be more easily embedded in applications.[4]

Text editors which have official integrations with Tree-sitter include Atom,[5] GNU Emacs,[6] Neovim,[7] Lapce,[8] Zed,[9] and Helix.[10] 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 made for all of these languages and dozens of others.[4] GitHub uses Tree-sitter to support in-browser symbolic code navigation in git repositories.[11]

Tree-sitter's internal architecture was informed by computer scientist Tim A. Wagner's dissertation, Practical Algorithms for Incremental Software Development Environments (1998).[12] Tree-sitter uses a GLR parser, a type of LR parser.[13][12][11]

Tree-sitter was originally developed by GitHub for use in the Atom text editor, where it was first released in 2018.[5]

External Links

References

  1. "Introductory to Treesitter". https://teknologiumum.com/posts/introductory-to-treesitter. 
  2. "TreeSitter - the holy grail of parsing source code" (in en). https://symflower.com/en/company/blog/2023/parsing-code-with-tree-sitter/. 
  3. Petersen, Mickey. "Tree Sitter and the Complications of Parsing Languages" (in en). https://www.masteringemacs.org/article/tree-sitter-complications-of-parsing-languages. 
  4. 4.0 4.1 "Tree-sitter|Introduction". https://tree-sitter.github.io/tree-sitter/. 
  5. 5.0 5.1 Brunsfeld, Max (2018-10-31). "Atom understands your code better than ever before" (in en-US). https://github.blog/2018-10-31-atoms-new-parsing-system/. 
  6. "GNU Emacs NEWS -- history of user-visible changes.". https://www.gnu.org/savannah-checkouts/gnu/emacs/news/NEWS.29.1. 
  7. "Treesitter - Neovim docs". https://neovim.io/doc/user/treesitter.html. 
  8. "lapce/CHANGELOG.md at f4747fbd306a4b8fda6927e37593bf23f4a1584b · lapce/lapce" (in en). https://github.com/lapce/lapce/blob/f4747fbd306a4b8fda6927e37593bf23f4a1584b/CHANGELOG.md. 
  9. "Zed - Code at the speed of thought". https://www.zed.dev/. 
  10. "Helix". https://helix-editor.com/news/release-22-03-highlights/. 
  11. 11.0 11.1 Clem, Timothy; Thomson, Patrick (2021-08-31). "Static Analysis at GitHub: An experience report" (in en). Queue 19 (4): 42–67. doi:10.1145/3487019.3487022. ISSN 1542-7730. https://dl.acm.org/doi/10.1145/3487019.3487022. 
  12. 12.0 12.1 12.2 (in en) "Tree-sitter - a new parsing system for programming tools" by Max Brunsfeld, https://www.youtube.com/watch?v=Jes3bD6P0To, retrieved 2023-07-30 . See 22:30 for Wagner influence and 29:27 for GLR implementation.
  13. Nadeem, Ayman (2020-08-04). "CodeGen: Semantic's improved language support system" (in en-US). https://github.blog/2020-08-04-codegen-semantics-improved-language-support-system/.