That hash symbol

Mike Samuel mikesamuel at
Sun Mar 27 09:24:48 PDT 2011

2011/3/27 Wes Garland <wes at>:
> On Sat, Mar 26, 2011 at 10:44 PM, Brendan Eich <brendan at> wrote:
> FunctionExpression :
> function Identifieropt ( FormalParameterListopt ) { FunctionBody }
> or
>  `Identifieropt  FormalParameterListopt  { FunctionBody }`
> ..although my "native thought pattern" is definitely LALR(1).  I find LL(k)
> ambiguities hard to spot, not having worked with a top-down parser-generator
> since I was in school!  Argh, now I'm not sure if that grammar is
> unambiguous for small k due to nested FunctionExpressions.  I don't think
> there is a comma-expression hazard there, though.

The need to balance the curly brackets in the body makes it
unambiguous for nested function expressions.  You don't need to look
ahead to tell whether a back-tick is an opening or closing back-tick,
just remember whether the last-non-comment-non-whitespace token was a
close curly that closed a function expression's body.
It is ambiguous with
if quasi type tags are optional.

More information about the es-discuss mailing list