Skip to content
treesitter is a Nim wrapper for the tree-sitter library
Nim
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lang Fix languages for treesitter API change Jul 18, 2019
treesitter Fix languages for treesitter API change Jul 18, 2019
treesitter_agda Fix languages for treesitter API change Jul 18, 2019
treesitter_bash
treesitter_c Fix languages for treesitter API change Jul 18, 2019
treesitter_c_sharp Fix languages for treesitter API change Jul 18, 2019
treesitter_cpp
treesitter_css Fix languages for treesitter API change Jul 18, 2019
treesitter_go Fix languages for treesitter API change Jul 18, 2019
treesitter_haskell Fix languages for treesitter API change Jul 18, 2019
treesitter_html Fix languages for treesitter API change Jul 18, 2019
treesitter_java Fix languages for treesitter API change Jul 18, 2019
treesitter_javascript Fix languages for treesitter API change Jul 18, 2019
treesitter_ocaml Fix languages for treesitter API change Jul 18, 2019
treesitter_php
treesitter_python Fix languages for treesitter API change Jul 18, 2019
treesitter_ruby Fix languages for treesitter API change Jul 18, 2019
treesitter_rust
treesitter_scala
treesitter_typescript Custom for Typescript Jul 18, 2019
.gitignore Fix namespace issue Dec 16, 2018
LICENSE Initial version Nov 13, 2018
README.md
genlang.nims Fix languages for treesitter API change Jul 18, 2019

README.md

treesitter is a Nim wrapper for the tree-sitter library.

treesitter is distributed as a Nimble package and depends on nimgen and c2nim to generate the wrappers. The tree-sitter source code is downloaded using Git so having git in the path is required.

Installation

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:

  • Agda
  • Bash
  • C / C++ / C# / CSS
  • Go
  • Haskell, HTML
  • Java, Javascript
  • OCaml
  • PHP, Python
  • Ruby, Rust
  • Scala
  • Typescript

Usage

Refer to the tests directory for examples on how the library can be used.

Credits

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.

Feedback

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.

You can’t perform that action at this time.