alaviss / tree-sitter-nim

tree-sitter grammar for Nim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree sitter grammar for Nim

A tree-sitter grammar for Nim.

The goal is to parse a superset of Nim and create a syntax tree that can be easily ingested by tools.

Notes

Generating this parser take around 7GiB of memory. Any help in reducing the parser size is appreciated.

Progress

Right now the parser is capable of parsing all of Nim, with exceptions for old and mostly unused/dead syntax, including:

  • Package-level objects (ie. type X.Y = ref Z)

  • Variable declaration with dots for "partial" objects (ie. let x.y = z).

  • Covariance in generics for imported types (ie. type X[out T] = Z).

These were omitted due as they are a product of old language experiments that never caught on, and omitting them allows for simpler and more compact parser, but support might be added on request.

The parser correctness has not been thoroughly tested.

Stability

Node names and structures are not expected to change between releases.

License

The project is licensed under the Mozilla Public License version 2.0

About

tree-sitter grammar for Nim

License:Mozilla Public License 2.0


Languages

Language:JavaScript 42.6%Language:C 33.3%Language:C++ 10.0%Language:Makefile 3.4%Language:Scheme 2.7%Language:Rust 2.6%Language:Python 2.4%Language:Swift 1.4%Language:Nim 0.9%Language:Go 0.7%