antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
9.96k stars 3.68k forks source link

Keep a repository of ANTLR4 grammars converted to flex/bison #4148

Open coderextreme opened 1 week ago

coderextreme commented 1 week ago

I tried converting my ANLTR4 grammar to flex/bison with ChatGPT, and it just did it. I haven’t tested it yet. It would seem to be handy to keep grammars in other meta-grammars, to save on many people doing the same thing. I’d like to see what my generated grammar does in Pyacc/Plex (pascal). Convert to those didn’t really work, last I tried.

kaby76 commented 1 week ago

The main problem retaining converted grammars to other parser generators is that there will be grammars that will need to be kept in synch with each other. If we provide an automated means of converting from Antlr4 syntax to Bison, for example on a PR merge, change tracking becomes a problem because the author of the automated change is not tied to the user. If we don't provide an automated means of doing the conversion, this will lead to a version skew between the Antlr4 grammar. People only do the minimal amount of work: (a) they don't port to all the targets; (b) they only make changes for one target, and punt on changes for the other targets by narrowing the list of supported targets in the desc.xml.