Rule 317

liorean liorean at
Tue Oct 23 05:58:37 PDT 2007

On 23/10/2007, David Teller <David.Teller at> wrote:
>     Hello list,
>  I'm still fighting the syntax of JS2. Attempting to feed it into a
> parser generator (menhir, for the moment), has already allowed me to
> find a few typoes in the spec and a few useless variables in the
> reference implementation, which is all I have to show for the moment.
> That and the fact that all XML* productions seem absent from the RI.
> At the moment, though, I'm being puzzled by rule 317:
> ExpressionStatement
> |  ListExpression (allowColon, allowIn)
>    [if lookahead not in { "function", "let", "{" }]
> Besides the fact that this rule is annoying to implement, does it
> actually mean what it intends ? In addition to blocks, it also prevents
> an assignment to an object pattern from starting the ListExpression. Is
> that desired ?

It's there to prevent the grammar from being ambiguous. "function",
"let" and "{" have different meaning in statement context from
expression context. If the ExpressionStatement construct allowed them,
then they would be ambigous in statement context, they could have
either the statement or the expression semantics. So, in order to
prevent this ambiguity, they are not allowed in ExpressionStatement.
David "liorean" Andersson

More information about the Es4-discuss mailing list