vlang / v-analyzer

The @vlang language server, for all your editing needs like go-to-definition, code completion, type hints, and more.
MIT License
118 stars 16 forks source link

Easier/cleaner way to write tree-sitter grammar #118

Open mingodad opened 3 months ago

mingodad commented 3 months ago

Describe the feature

Here https://mingodad.github.io/lua-wasm-playground/ there is an easier/cleaner way to write tree-sitter grammars like V (select Tree-sitter-ebnf-generator-V from Examples then click Run to see a full commented out grammar.js from the EBNF variant describng the grammar in Input Text (arg[1])).

I hope it can be helpful !

Use Case

Less work and better communication of the intent.

Other Information

No response

prashanth-hegde commented 2 months ago

Unfortunately, this repo has been archived for three years. https://github.com/eatkins/tree-sitter-ebnf-generator

While it may serve us to tweak the grammar once-a-while, for a long-running and continuous development like V, we need a sustainable and well supported toolchain in order to rely upon the solutions

mingodad commented 2 months ago

The code isn't big and I already did several fixes to it but a real parser would be better. It for sure proved the point that having a declarative way to describe grammars is superior in my opinion.

spytheman commented 1 month ago

In the long term, we should ditch tree-sitter completely, and use pure V imho.

Because of Tree Sitter, this project uses V, C, and JS, and the relationships between them are unclear and easy to forget.

It also uses a git submodule for tree-sitter, an improvement over the previous state, where you had to clone its repo separately and then keep it synchronized manually. However, it still complicates daily operations and requires a separate build process.

From a maintenance point of view, it would have been much simpler to use a single language for all of it.

spytheman commented 1 month ago

I do not see how adding Lua to the mix will simplify things.

mingodad commented 1 month ago

The simplification is on the grammar used to write a tree-sitter grammar the fact that the one pointed here is implemented in Lua is a implementation detail.