Skip to content

Ambiguities: syntactical vs. semantic #965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Nigel-Ecma opened this issue Oct 10, 2023 · 4 comments
Open

Ambiguities: syntactical vs. semantic #965

Nigel-Ecma opened this issue Oct 10, 2023 · 4 comments
Assignees
Milestone

Comments

@Nigel-Ecma
Copy link
Contributor

Nigel-Ecma commented Oct 10, 2023

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…

@Nigel-Ecma Nigel-Ecma added this to the Pre-C# 8.0 milestone Oct 10, 2023
@Nigel-Ecma Nigel-Ecma self-assigned this Oct 22, 2023
@Nigel-Ecma Nigel-Ecma added the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Oct 22, 2023
@jskeet
Copy link
Contributor

jskeet commented Nov 1, 2023

Leaning towards the third option, which would mean adding the semantic ambiguities into 6.2.5 and keeping them in the context (where they are already). We are just concerned about whether we can be complete in this.

@jskeet
Copy link
Contributor

jskeet commented Nov 1, 2023

Deferring until a meeting where @MadsTorgersen is around.

@jskeet jskeet added meeting: discuss This issue should be discussed at the next TC49-TG2 meeting and removed meeting: discuss This issue should be discussed at the next TC49-TG2 meeting labels May 15, 2024
@jskeet
Copy link
Contributor

jskeet commented Jun 12, 2024

Resolution on 2024-06-12:

  • Try to collect everything in 6.2.5 over time, but only informatively and only as a list of links effectively with very brief descriptions
  • Always describe it semantically in context; if there are multiple contexts that aren't very close together, define it in both places (once normatively, once as an informative link)

@jskeet
Copy link
Contributor

jskeet commented Jun 12, 2024

@Nigel-Ecma to file specific bugs for known issues, then close this one.

@jskeet jskeet removed the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants