antlr / grammars-v4

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

C++17 or C++20 #2475

Open rusefillc opened 2 years ago

rusefillc commented 2 years ago

CPP14 is great but they now have C++17 and C++20, would be great to add or update current cpp grammar

kaby76 commented 2 years ago

I've been working on scraping via program the grammars from the official and draft Specs for C++14, 17, and 20--every one of them. The scraper tool extracts the grammar and creates a file in pseudo Antlr syntax. I then use Trash to refactor the grammar into a working Antlr grammar. The big problem is figuring out all the extensions. Every damn system header uses extensions. There's no documentation on the extensions either (or it's out of date, e.g., GNU). I haven't looked much into Clang nor VS C++ because I am stuck on GNU still. I haven't yet added semantic predicates to switch on/off extensions, but that should be done so we know what change was for what extension rather than continue with the unfettered and undocumented changes that have so far been creeping into the grammar.

ssine commented 4 months ago

Hi @kaby76, Is it possible to release a version of cpp17/20 grammar without extensions? That would be helpful too if including extensions takes too much work.