return when desugaring to closures
waldemar at google.com
Fri Oct 17 11:23:56 PDT 2008
Maciej Stachowiak wrote:
> I think it might be better to write the official ES3.1 grammar in this
> way, even though it is a little annoying and repetitive, so it can more
> readily be verified that the language grammar has no ambiguities by
> running through a parser-generator like yacc or bison or boost::spirit.
I machine-verified the ES3 grammar directly and have a parser that supports the negative lookaheads. I'm using those in addition to the "NoIn" markers because otherwise there'd be an exponential blowup in the number of productions in the grammar to handle all the cases in ES4.
Yacc or bison or such are insufficient. You also need to verify that semicolon insertion is sound and that there exist no grammar states combining a / division in some branches with a / regexp in other branches in the same spot. This would break the lexer because you'd need to look ahead to resolve the ambiguity but can't because lexing depends on how you resolve that token.
Also, the ES4 grammar turned out to be LR(1), not LALR(1) as needed by yacc.
More information about the Es-discuss