It would be nice to have a Tree-sitter <https://tree-sitter.github.io/tree-sitter/> parser for Nim. I tried to make one, but had severe issues with the ambiguity of Nim's grammar (Tree-sitter doesn't support ordered choice). Maybe someone with more expertise could tackle it?
A Tree-sitter implementation could be useful for IDE-like features such as smart syntax highlighting, syntax-aware selection, argument swapping and other IDE-like features.
Maybe someone with more expertise could tackle it?
Ask me specific questions on Discord please.
as smart syntax highlighting
NOOOOOOOOOOO.......
syntax-aware selection, argument swapping and other IDE-like features.
OK. :-)
I wrote one a few years ago based on the python parser: https://github.com/paranim/tree-sitter-nim
I won't claim that it's perfect...it probably needs some love, but I used it to provide nim syntax highlighting in my text editor: https://github.com/paranim/paravim/blob/master/src/paravim/tree_sitter.nim
BTW the scanner in tree-sitter-nim comes from tree-sitter-python and is written in C++, but in paravim I converted it to a plain C version so I could build it with nim's C backend. If you are looking to use tree sitter as a library embeded in a nim project you probably should start with that.
I think this could also get us support for semantic diffs via difftastic: