grammars-v4
grammars-v4 copied to clipboard
[Question] Why are include statements ignored in the cpp grammar?
While working with the cpp grammar I noticed that the include statements in the examples are ignored by the parser.
I tried to educate myself with the C++ standard appendix on grammar and noticed that include statements are also not mentioned. Or did I miss it?
What is the reason for that?
Okay I found them mentioned in an older standard. Why are there no preprocessing directives in the cpp grammar at all?
The Spec divides the C++ grammar into two phases, with the grammar shared between both. But, the driver here is not set up for two parsers, where the output is fed to another. I have another grammar with base clases to do this, but it is different than the one here, and much closer to the Spec. I haven't investigated how the grammar in this repo differs from the Spec and why yet. People have made a lot of changes with zero documentation (all changes should have an Issue credited to accompany the PR). I also do not like how this grammar is not labeled after the version of the Spec.
My plan is to redo this grammar.
Thank you for your answer. I would offer my help but I'm not sure how much I can with my limited antlr knowledge at the moment.