-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove duplicate productions. #370
Conversation
Specifically, in 7.1.3.1 "ToNumber Applied to the String Type", remove the productions for: DecimalDigits DecimalDigit ExponentPart ExponentIndicator SignedInteger which duplicate productions (modulo the number of colons) in 11.8.3 "Numeric Literals". (Note that 7.1.3.1's Syntax already uses nonterminals defined in 11.8.3 (e.g. BinaryIntegerLiteral), and already has a sentence referring readers there for the definitions thereof.) With this change, each nonterminal should have a single defining production within the body of the spec (i.e., ignoring Annex B), which should reduce link-target suprises in the rendered spec.
I still need to implement a primary attribute in emu due to the usage of real productions in clause 5 (eg. WhileStatement). I had assumed that this existed for some reason as the duplication goes back at least to ES5. But the productions are equivalent other than the colons. I wonder what @allenwb thinks. Are we missing something? |
In fact it goes all the way back to ES1. I suggested removing the duplicates back in 2012 (https://bugs.ecmascript.org/show_bug.cgi?id=632). In ES6 rev 28 (2014-10-14), Allen removed (from "ToNumber Applied to the String Type") the MV rules for the I'm pretty sure there's no normative effect, it's just an editorial choice. |
@jmdyck wow awesome, thanks for the history! I also can't discern any normative effect here so will pull this in. (Also, so happy to see PRs from you again 👍) |
Specifically, in 7.1.3.1 "ToNumber Applied to the String Type",
remove the productions for:
DecimalDigits
DecimalDigit
ExponentPart
ExponentIndicator
SignedInteger
which duplicate productions (modulo the number of colons)
in 11.8.3 "Numeric Literals".
(Note that 7.1.3.1's Syntax already uses nonterminals defined
in 11.8.3 (e.g. BinaryIntegerLiteral), and already has a
sentence referring readers there for the definitions thereof.)
With this change, each nonterminal should have a single defining
production within the body of the spec (i.e., ignoring Annex B),
which should reduce link-target suprises in the rendered spec.