Skip to content
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

spec: the word terms not used properly in EBNF description #50074

Closed
Cages-hub opened this issue Dec 9, 2021 · 4 comments
Closed

spec: the word terms not used properly in EBNF description #50074

Cages-hub opened this issue Dec 9, 2021 · 4 comments

Comments

@Cages-hub
Copy link

Productions are expressions constructed from terms and the following

This line seems to ignore Alternative in the EBNF specification above it:

Expression  = Alternative { "|" Alternative } .
Alternative = Term { Term } .

The line would make more sense if it was using identifiers used in Wirth's EBNF specification:

expression = term {"|" term}.
term = factor {factor}.
@seankhliao seankhliao changed the title The word terms not used properly spec: the word terms not used properly in EBNF description Dec 9, 2021
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 9, 2021
@ianlancetaylor ianlancetaylor added this to the Go1.18 milestone Dec 9, 2021
@ianlancetaylor
Copy link
Contributor

CC @griesemer

@griesemer griesemer added Thinking and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 11, 2021
@griesemer
Copy link
Contributor

Fair point. The notion of a term would also be closer to the usual mathematical use as an operand in a sum (or a list of alternatives as the case is here). That said, factor - while again the usual mathematical nomenclature - does not seem very evocative in this context. Perhaps we should say

Productions are expressions constructed from Alternatives and the following operators, in increasing precedence:

and look for a better name than term.

The current writing deliberately skips Alternatives because at the end all we have is Terms.

@Cages-hub
Copy link
Author

Cages-hub commented Dec 11, 2021

Skipping Alternative implies the current description does not apply to FunctionType = "func" Signature .

Using the specs current nomenclature I would suggest:

Expression = Sequence { "|" Sequence } .
Sequence = Element { Element } .
Element = production_name | token [ "…" token ] | Group | Option | Repetition .

@griesemer griesemer modified the milestones: Go1.18, Go1.19 Feb 9, 2022
@gopherbot
Copy link

Change https://go.dev/cl/405814 mentions this issue: spec: use original terminology in metasyntax (cleanup)

@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants