portfolio/src/tree_sitter.dj
Isaac Mills fc946144b0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Extend data baking to cosmic_jotdown
2024-04-19 23:07:35 -04:00

14 lines
1.2 KiB
Text

# Tree-sitter (and other IDE tooling) Experience
[tree-sitter](https://tree-sitter.github.io/tree-sitter/) is a parser generator that takes a grammar written in JavaScript notation, and outputs a very fast parser written in C with incremental capabilities. Parsers generated by tree-sitter take source code and generate an abstract syntax tree which you can either walk manually, or get specific nodes out of using S-expressions.
Because of tree-sitter's incremental-parsing and tree-querying capabilites, making language servers for languages with a supported grammar is relatively trivial.
- This is a snippet of [grezi](https://github.com/StratusFearMe21/grezi-next) source code, a plain-text based slideshow program that I made that uses exclusively tree-sitter for parsing, syntax highlighting, and running a language server that provides inline annotations.
![A snippet of grezi source code](images/grezi.jpg#256x368)
- This is an instance of a language server I made, with a parser backed by tree-sitter, providing syntax highlighting, folding ranges, and a document outline for a [djot](https://djot.net) document in VSCode (VSCode doesn't normally support djot)
![A VSCode window with syntax highlighted djot source](images/vscode.jpg#256x256)