treesitter can be installed via Nimble:
> nimble install treesitter
This will download, wrap and install treesitter in the standard Nimble package location, typically ~/.nimble. Once installed, it can be imported into any Nim program.
Individual language grammars can be installed as well to parse source files:
> nimble install treesitter_c
This will download, wrap and install the C grammar. Given treesitter is a dependency, any language grammar can be installed directly and treesitter will get installed automatically.
Grammars are available for the following languages:
- C / C++ / C# / CSS
- Haskell, HTML
- PHP, Python
- Ruby, Rust
Refer to the
tests directory for examples on how the library can be used.
This library wraps the tree-sitter source code and all licensing terms of tree-sitter apply to the usage of this package.
Credits go out to c2nim as well without which this package would be greatly limited in its abilities.
treesitter is a work in progress and any feedback or suggestions are welcome. It is hosted on GitHub with an MIT license so issues, forks and PRs are most appreciated.