Re:Scandalous Weird Old Things About The C Preprocessor (2015)
by yorwba on Tuesday May 30, 2017 @10:33AM
(#14445636)
Yes, the real reason C preprocessor syntax can't be described by a context-free grammar is that parsing and execution are interleaved. This requires the parser to carry the set of current macro definitions for each parsing decisions, which implies non-context-freeness.
However, see [0] for a way to parse C with preprocessor #ifdefs (but after expanding #includes and #defines).
However, see [0] for a way to parse C with preprocessor #ifdefs (but after expanding #includes and #defines).
[0] "SuperC : Parsing All of C by Taming the Preprocessor" http://cs.nyu.edu/rgrimm/papers/pldi12.pdf