dlang.org
dlang.org copied to clipboard
Remove the 'Symbol' rule from the grammar.
http://forum.dlang.org/thread/[email protected]
The Symbol
rule only appears as an alternative to the Type
, AssignExpression
, or Expression
rules, but the Symbol
rule is a subset of these other rules. Because of this, the grammar is ambiguous.
The difference between a type, expression, and symbol is something that can only be determined during semantic analysis, and thus should not be part of the parse grammar.
But a template argument to an alias parameter can be any symbol, such as a module name. A module name is neither a type nor an expression.
(Types and Expressions can also be ambiguous.)
I don't see what that kind of semantic information has to do with creating a parse tree, unless we're going the C++ route of requiring semantic in order to parse.
To clarify, a module name (e.g. std.experimental.allocator
) parses as an expression through the PostfixExpression rule.