Closed felipensp closed 4 months ago
Hi @felipensp, thanks a lot for your work on this!
It would be great to add V backend, but it needs to be done in a different way. Recently there have been quite a few requests to add other languages (D, Js, OCaml, Zig... now V). The problem with the current approach is, it does not scale well: the code becomes polluted with special cases for each language. Most importantly, in order to test all re2c features with the new code, it is necessary to implement all examples and update docs, including https://re2c.org. Understandably, contributors don't have time for all this work.
So, I'm working on a different approach that will make implementing new backends as easy as writing a single config file that describes element of the syntax of the target language. See https://github.com/skvadrik/re2c/issues/450 for details. The work is being done on syntax-files
branch. I already made good progress on this, and I even have OCaml support locally (which is much more different from C/C++ than V). So I think it will be an easy job to add V after this work is done.
With the new approach, we can have second-tier language support (just add a syntax file, but don't add any tests/docs). It won't affect re2c code.
Unfortunately, I have not much free time at the moment. I'm working on it, but but it's a matter of months, not weeks/days. I should not rush this work anyway, because the moment it gets released it will become stable user interface for the foreseeable future. So I cannot promise I will add V support soon.
Parts of your work can still be reused (those related to options and build systems).
Vlang support was added in experimental branch syntax-files
in https://github.com/skvadrik/re2c/commit/73853c5ea7a98d19c174f508bb226876c61a024f.
In particular, see examples here: https://github.com/skvadrik/re2c/tree/73853c5ea7a98d19c174f508bb226876c61a024f/examples/v
Closing as obsolete - Vlang support has been merged into master.
Many thanks @skvadrik
This PR aims to add support for V lang on re2c.
Example
Running
re2v ../v_example_01.v | v run -