return when desugaring to closures
Waldemar Horwat
waldemar at google.com
Fri Oct 17 11:17:57 PDT 2008
Maciej Stachowiak wrote:
> As to the else issue, I don't think that ambiguity can be avoided, but
> bison lets you solve that with %nonassoc, which is a sound
> disambiguation mechanism.
It can. I have a machine-validated ES3 (and ES4 from earlier proposals) grammar that contains no ambiguities and no handwaving. The if-else rule is handled by having a marker on Statement productions just like there is a NoIn marker on Expression productions. See:
http://www.mozilla.org/js/language/old-es4/core/statements.html#N-IfStatement
I need a grammar with no ambiguities to do things like verify that semicolon insertion works and that the / regexp-vs-division resolution is always uniquely resolvable in favor of one or the other: you don't ever want a parser state which combines rules that have division with rules that have a regexp in the same spot because the lookahead depends on how you lex the /-token.
Waldemar
More information about the Es-discuss
mailing list