archives

« Bugzilla Issues Index

#632 — repetition between 7.8.3 & 9.1.3.1


The Syntax sections of
7.8.3 "Numeric Literals"
and
9.1.3.1 "ToNumber Applied to the String Type"
have a fair bit of overlap. They each have a production for:
DecimalDigits
DecimalDigit
ExponentPart
ExponentIndicator
SignedInteger
HexIntegerLiteral
HexDigits
and in each case, the two productions are the same, modulo colons. (Except for HexIntegerLiteral, which was recently changed in 7.8.3 but not in 9.1.3.1. But the two definitions are still equivalent.)

Moreover, the rules for the MV of these productions are the same in 7.8.3 and 9.1.3.1 (except, of course, for HexIntegerLiteral, but again they are equivalent).

Finally, I believe these are the only cases in the spec where a nonterminal name is defined in more than one grammar (i.e., the lexical grammar and the numeric string grammar).


Therefore, I think it would be a significant improvement if the overlap between these two sections were eliminated. I think it would suffice to delete the relevant chunks of 9.1.3.1 and add a sentence referring the reader to 7.8.3. (Note the precedent of the RegExp grammar in 15.10, which refers to symbols defined in 6, 7.6, 7.8.3, and 7.8.4.)

It also might help to change 3-colons to 2-colons in the remaining productions in 9.1.3.1, to avoid potential confusion about whether a 3-colon production can reference a symbol defined by a 2-colon production.

And the spec could give assurances that although its syntax is divided into several grammars for organizational purposes, there's nothing (no symbol collisions) to prevent an implementation from viewing all productions as being in a single grammar.


Whoops, in that list of common nonterminal names, "HexDigits" should be just "HexDigit".


(There's also the precedent that the JSON lexical grammar uses nonterminals defined in clause 7.)


Deferring to ES7