return when desugaring to closures
Eric Suen
eric.suen.tech at gmail.com
Fri Oct 17 19:36:06 PDT 2008
>> The parser is required to backtrack until it either finds an
>> expansion of the grammar that doesn't generate a syntax error or
>> until it discovers that they all do. You can choose to make
>> additional syntax errors as per chapter 16, but that does not
>> relieve you of the backtracking requirement.
>
> You're right that a bottom up parser will have a reduce-reduce
> conflict. For a top-down parser, it's not an issue.
>
Are you sure about that, because you using hand written top-down parser,
Is it confirmed by a top-down parser generator like ANTLR?
I think top-down parser has no issue to parse following code:
function() {
}();
but this is not a valid statement because:
ExpressionStatement ::= [lookahead ! {{, function}] Expression ;
This kind question I asked long time ago, but no one answed,
https://mail.mozilla.org/pipermail/es-discuss/2008-July/006640.html
and now seems write a bottom up JS parser is mission impossible.
Regards,
Eric Suen
More information about the Es-discuss
mailing list