ecma262
ecma262 copied to clipboard
Address possible ambiguities in grammar productions
Following a discussion about a failing test262 test for the Temporal proposal in the LibJS engine due to a grammar ambiguity, it was raised that it's not immediately obvious from the specification text how possibly ambiguous grammar productions should be handled, e.g. are they inherently editorial errors, or, if they are not, which sub production should be prioritised? (by order in the sub-production list?) This is especially important in the case of Temporal, as following the parsing the the specific sub productions are referenced and checked for existence, so such an ambiguity can result in a different conditional being taken.
Clarification on this would be appreciated. (And maybe we could also explicitly address it in the Syntactic and Lexical Grammars section of the specification text)
P.S. An example of a possible 'ambiguous' production - the following is ambiguous for the input of 1:
ExampleProduction:
OctalDigit
HexDigit
Ambiguous productions are inherently editorial errors (except for the RegExp grammar given in Annex B, which explicitly notes how ambiguities are broken).
I'm not totally sure it's worth writing that down in the spec itself, but we should at least document it alongside other editorial conventions somewhere.
Thanks for the swift response! I have no strong feelings about the location of the documentation, just one data point towards putting it in the specification itself is that as implementers we probably wouldn't have looked for editorial conventions when trying to understand this specific issue.
@IdanHo can you link to LibJS? Is it a new engine?
LibJS is SerenityOS's native from-scratch javascript engine (used in-tandem with LibWeb for Serenity's native browser), it is relatively new, work started in 2020. The source code is available here: https://github.com/SerenityOS/serenity/tree/master/Userland/Libraries/LibJS Automatically updated test262 results here: https://libjs.dev/test262/ And it's also supported by esvu.