>> 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 _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss