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

Editorial: Tweak the syntax of grammatical parameters. #571

Merged
merged 1 commit into from Jun 9, 2016

Conversation

jmdyck
Copy link
Collaborator

@jmdyck jmdyck commented May 17, 2016

(Make things more explicit, and establish a clearer parallel between rhs-guard syntax and rhs-nonterminal use syntax.)

Resolves Issue #374.

@littledan
Copy link
Member

I like the change for [+foo] on the RHS--that definitely make it easier to read. I wouldn't be opposed to using [foo] on the RHS to mean [?foo], but it's reasonable to be conservative here.

What does [~foo] mean when after (rather than before) a production, as you use in this patch?

The patch should probably update the frontmatter to define the new grammar language.

@jmdyck
Copy link
Collaborator Author

jmdyck commented May 22, 2016

What does [~foo] mean when after (rather than before) a production, as you use in this patch?

(For "production", I assume you mean "nonterminal".) It's a way to explicitly denote that the foo parameter is "not present" for that reference to the nonterminal. See issue #374 and the old bug it references for reasons why this is useful.

In my proposal, all of a nonterminal's parameters appear (with +/~/? prefixes) in each of its invocations (at least in 'defining' productions). Given this, it makes less sense to describe the possible 'states' of a parameter as "present" or "not present". I started to work on changing that terminology, but dropped those edits, since they were distracting from the main point of the PR.

The patch should probably update the frontmatter to define the new grammar language.

It does. The proposed notation is explained to the same level of detail as the current notation (which is to say, not much).

@claudepache
Copy link
Contributor

Having recently played a little with the parametrised grammar, I support this change (or some other change that would solve the following issue): because currently the notation [foo] means different things when used on the LHS or on the RHS of a grammar rule, and moreover there is no evident way to make clear which meaning you want when you use that notation outside a grammar rule.

For the proposed substitution [?foo][foo] on the RHS: I have thought the other way round, namely [foo][?foo] on the LHS. Anyway: this is less an issue once the two current uses of [foo] are disambiguated.

@jmdyck
Copy link
Collaborator Author

jmdyck commented May 23, 2016

currently the notation [foo] means different things when used on the LHS or on the RHS of a grammar rule, and moreover there is no evident way to make clear which meaning you want when you use that notation outside a grammar rule.

Yup, that's basically reason (2) at https://bugs.ecmascript.org/show_bug.cgi?id=2794

For the proposed substitution [?foo][foo] on the RHS

(To be clear, that was part of the proposal in Bug 2794, but isn't in this PR, for reasons explained in Issue #374.)

I have thought the other way round, namely [foo][?foo] on the LHS.

Hm, that hadn't occurred to me. I'm not sure I prefer it, but I don't think I'd have a serious objection.

@bterlson
Copy link
Member

bterlson commented Jun 3, 2016

I like this a lot. I've filed rbuckton/grammarkdown#19 on Grammarkdown to add parsing support for this, and once this lands I will accept this PR!

(Make things more explicit, and establish a clearer parallel
between rhs-guard syntax and rhs-nonterminal use syntax.)

See https://bugs.ecmascript.org/show_bug.cgi?id=2794
and tc39#374
@bterlson
Copy link
Member

bterlson commented Jun 9, 2016

And we've got Grammarkdown support! Merging this in.

@bterlson bterlson merged commit 1244a0b into tc39:master Jun 9, 2016
@jmdyck jmdyck deleted the grammar_params branch June 9, 2016 20:22
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

Successfully merging this pull request may close these issues.

None yet

4 participants