This is probably a silly question to people knowledgeable about compilers, but I'm honestly ignorant about the answer.
Is C++ syntax context-sensitive? In other words, is C++ syntax not expressible with context-free grammars?
Obviously C++ is parsed with regular parsing tools and that parsing is not particularly ineffective (!), but I do recall reading something about this (I don't remember where) and I thought I'd get my facts straight with the community before spreading lies... Maybe a subset of C++ is CS? Maybe the new spec? Any help is appreciated.
EDIT: Thanks for all the responses. However, for completeness' sake, what part of compilation deals with the ambiguity? A CFG is a grammar that has only one non-terminal symbol on the left-hand-side of the rule (eg. A->zC
), a CSG is one that has a terminal (plus a non-terminal) on the left-hand-side (aAv->QT
), where uppercase letters are nonterminals and lowercase are terminals. Is any representation like the latter in the grammar parsing C++ source code?
Thanks.