O
Ole Nielsby
The C++ syntax goes like:
type-id:
type-specifier-seq abstract-declarator(opt)
type-specifier-seq:
type-specifier type-specifier-seq(opt)
which means, a type-id has 1 or more type-specifiers in it.
This introduces ambiguities. Assuming no namespace, and declarations
class a{public: class b{};};
class b{};
this type-id:
a::b
could parse as a seq of two type-specifiers, a and ::b .
Is it possible to tighten the grammar into something like:
type-id:
type-modifier-seq(opt) type-specifier abstract-declarator(opt)
type-modifier-seq:
type-modifier type-modifier-seq(opt)
type-modifier
_signed_
_unsigned_
_short_
_long_
...
.... or are matters more complicated than that? Are there situations where
a type-id would be prefixed by anything other than
signed/unsigned/short/long keywords?
type-id:
type-specifier-seq abstract-declarator(opt)
type-specifier-seq:
type-specifier type-specifier-seq(opt)
which means, a type-id has 1 or more type-specifiers in it.
This introduces ambiguities. Assuming no namespace, and declarations
class a{public: class b{};};
class b{};
this type-id:
a::b
could parse as a seq of two type-specifiers, a and ::b .
Is it possible to tighten the grammar into something like:
type-id:
type-modifier-seq(opt) type-specifier abstract-declarator(opt)
type-modifier-seq:
type-modifier type-modifier-seq(opt)
type-modifier
_signed_
_unsigned_
_short_
_long_
...
.... or are matters more complicated than that? Are there situations where
a type-id would be prefixed by anything other than
signed/unsigned/short/long keywords?