[cfe-dev] decl/expr ambiguity
doug.gregor at gmail.com
Sun Aug 24 19:09:16 PDT 2008
On Sun, Aug 24, 2008 at 9:13 PM, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
> Doug Gregor wrote:
>> There are also places in C++ where we have to determine whether we're
>> looking at a type or an expression (e.g., in sizeof(blah)).
> Can you be more specific? The way I see it, you can skip through when
> expressions are expected without affecting the disambiguation process.
Perhaps sizeof() (and decltype, typeof, typeid) are not a concern,
then; one can skip through and count parentheses in the pre-parser.
> Are you talking about non-type template arguments ? I think in these cases
> common parsing methods can be used by both a pre-parser and normal parser.
Yes, that was the "fun" part I referred to. Template arguments can be
types or expressions, so the parser needs to be able to disambiguate
those (it resolves in favor of the type-id).
>> All that said, it might not matter so much whether we pre-parse now or
>> not. As those trickier parsing bits for types go into the parser, they
>> could probably be abstracted out to be useful for both the
>> pre-parser(s?) and the parser, to eliminate unnecessary code/coding
> Certainly! Resolving scope qualifiers and instantiating classes can be
How far does "instantiating classes" extend? Will we be sharing the
parsing of typename-specifiers and template-ids, for example?
More information about the cfe-dev