Skip to content

Ambiguities: syntactical vs. semantic #965

@Nigel-Ecma

Description

@Nigel-Ecma

This issue came to light as a result of #964 where an issue with the wording of an ambiguity described in §6.2.5 Grammar ambiguities was discussed and addressed.

Ambiguities are covered in two ways:

  • §6.2.5 Grammar ambiguities describes (historically?) ambiguities which are primarily syntactical. For example due to the multiple uses of the > & < tokens in the language – as comparison operators, shift operators and type argument brackets.
  • Elsewhere in Standard ambiguities which are semantic/syntactic are covered in context. For example in §12.19.1 discussing anonymous functions where two possible productions null_conditional_invocation_expression and expression could be applicable. The Standard specifies that the former shall be chosen and notes that the ANTLR grammar resolves this situation automatically – overlap between productions occurs in language grammars and priority rules are applied.

However #964 drew attention to an ambiguity relating to relational expressions, §12.12.1, being covered in §6.2.5 and not in context in §12.12.1. However these is an informative note in the latter (which needs work, see #935).

The issue to resolve is whether we should:

  • maintain a split; pure syntactical vs. (semantic/syntactic);
  • include all the ambiguities in §6.2.5;
  • include all ambiguities in §6.2.5, and only the semantic ones (e.g. "relational_expression is type") in context;
  • list all ambiguities in §6.2.5 and in context (I doubt anyone will want this, the purpose of §6.2.5 after all probably being to avoid discussion of angle brackets in context)

Tagging as Pre-C# 8.0 as it both stems from such an issue and I expect we might be adding more ambiguities as we move forward…

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions