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

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

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

Cages-hub opened this issue Dec 9, 2021 · 3 comments
Assignees
Milestone

Comments

@Cages-hub
Copy link

@Cages-hub Cages-hub commented Dec 9, 2021

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
@ianlancetaylor ianlancetaylor added this to the Go1.18 milestone Dec 9, 2021
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Dec 9, 2021

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 11, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants