dlang.org icon indicating copy to clipboard operation
dlang.org copied to clipboard

Remove the 'Symbol' rule from the grammar.

Open Hackerpilot opened this issue 7 years ago • 2 comments

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.

Hackerpilot avatar Jul 11 '16 18:07 Hackerpilot

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.)

WalterBright avatar Jul 12 '16 10:07 WalterBright

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.

Hackerpilot avatar Jul 12 '16 20:07 Hackerpilot