On Oct 20, 2011, at 12:31 AM, Andreas Rossberg wrote:

>  (Mh, actually, could we
> even distinguish between function declerations and expression
> statements starting with a function expr in LALR(1), without heavy
> grammar transformation?)

To answer this question, there's no way to disambiguate without a lookahead 
restriction or massive duplication of the expression sub-grammar. You'd need

  ExpressionStatement: ExpressionNoFunctionNoLeftCurlyAtFront

and ExpressionNoFunctionNoLeftCurlyAtFront would produce any expression except 
those starting with 'function' or '{'. No win in duplicating so much grammar. 
We'd rather use lookahead restrictions as the spec does currently, or 
parametric productions as an alternative (would be nice to unduplicate the 
-NoIn productions).

BTW there's still a de-facto standard lurking about on the web that expects 
eval("function(){...}") to parse. I'm not sure where different engines stand on 
this.

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to