Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upeditorial: More reasons to change the grammatical parameter notation #374
Comments
jmdyck
changed the title from
More reasons to change the grammatical parameter notation
to
editorial: More reasons to change the grammatical parameter notation
Feb 8, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Feb 8, 2016
Collaborator
@bterlson: If this sounds worthwhile, I'll prepare a pull request.
Originally, my proposal included changing N[?P] to N[P], but now I'm thinking I'll leave that part out. Keeping it in would increase the diff, and would also have the drawback that N[P]exists both before and after, but with different meanings, which might be confusing. (Keeping that substitution would also remove the ability to easily distinguish between LHS params and RHS pass-it-down params, though I'm not sure that makes much difference.)
|
@bterlson: If this sounds worthwhile, I'll prepare a pull request. Originally, my proposal included changing |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Feb 10, 2016
Member
Let's wait until after March 1 (when I snap for ES2016). I don't want to change the notation now. Also we'll have to wait for grammarkdown to get support for this new syntax. On the surface I think this change is definitely good, though, so let's work toward getting all the necessary pieces updated sometime after March 1.
|
Let's wait until after March 1 (when I snap for ES2016). I don't want to change the notation now. Also we'll have to wait for grammarkdown to get support for this new syntax. On the surface I think this change is definitely good, though, so let's work toward getting all the necessary pieces updated sometime after March 1. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Feb 10, 2016
Collaborator
Ah, I was hoping to get it in before the snap. But I guess I don't mind that much.
Also we'll have to wait for grammarkdown to get support for this new syntax.
Hm, yup, looks like it would complain about the new syntax.
|
Ah, I was hoping to get it in before the snap. But I guess I don't mind that much.
Hm, yup, looks like it would complain about the new syntax. |
jmdyck
referenced this issue
Feb 12, 2016
Closed
PropertyName doesn't inherit Yield in AssignmentProperty #388
bterlson
added
the
editorial change
label
Feb 17, 2016
added a commit
to jmdyck/ecma262
that referenced
this issue
May 17, 2016
jmdyck
referenced this issue
May 17, 2016
Merged
Editorial: Tweak the syntax of grammatical parameters. #571
added a commit
to jmdyck/ecma262
that referenced
this issue
May 18, 2016
added a commit
to jmdyck/ecma262
that referenced
this issue
Jun 3, 2016
added a commit
to jmdyck/ecma262
that referenced
this issue
Jun 7, 2016
added a commit
that referenced
this issue
Jun 9, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
PR #571 resolved this. |
jmdyck commentedFeb 6, 2016
In https://bugs.ecmascript.org/show_bug.cgi?id=2794, I proposed a small change to the notation of parameterized productions. In addition to the two reasons given there, I've recently thought of two more...
(3)
It makes bugs shallower.
Consider the production
This seems unremarkable, but imagine if it were written:
This makes it clear that
PropertyNametakes aYieldparameter, and yet it isn't inheriting theYieldsetting fromAssignmentProperty. My guess is that this is a bug (i.e., it should be[?Yield]), but even if it isn't, it's an anomaly that's worthy of explanation, and yet the question doesn't even arise with the current notation.(4)
Ease of search.
For example, say you're interested in the parameter 'Return'.
If you want to see what effect the Return parameter has on the grammar, that's easy: just search for
and you'll find it in the production for Statement, guarding the RHS for ReturnStatement. (You should also search for
[~Return], but won't get any hits outside of examples.)If you then want to see how a 'positive/present' setting for Return arises, that's not so easy. What you're looking for is a RHS (not LHS) nonterminal that has a subscript 'Return' (not '?Return'). For this, you need something like this (at least):
which finds that FunctionStatementList derives StatementList with a 'positive' Return. (That regex has potential problems; if you wanted a more bullet-proof regex, it would be more complicated.)
Finally, if you want to see how a 'negative/absent' setting for Return arises, you almost can't even do it with a regex. Now you're looking for a RHS nonterminal that could take a Return parameter, but doesn't have one. (If you really wanted a regex, you'd first need a list of all the nonterminals that are defined to take a Return parameter, and then you'd have figure out how to write a pattern for a []-subscript that doesn't contain 'Return', which might not be easy depending on your regex language.)
With my proposal, you could find all of the above just by searching for
or, if you want a regex for each specific question: