Questions on the notation used in the spec

Jeff Dyer jodyer at adobe.com
Mon Oct 22 11:38:50 PDT 2007



On 10/22/07 10:40 AM, Joel Reymont wrote:

> Folks,
> 
> I'm trying to create a Yacc grammar for ES4 and I have trouble
> understanding the notation used in the spec.
> 
> For example, there's
> 
> alpha = { allowColon, noColon }
> beta  = { allowIn, noIn }
> gamma = { allowExpr, noExpr }
> 
> and then
> 
> ParenExpression (  AssignmentExpression /allowColon, allowIn/  )
> 
> as well as
> 
> FunctionExpression /alpha, beta/
>    function  Identifier  FunctionSignature  FunctionExpressionBody /
> alpha, beta/
>    function  FunctionSignature  FunctionExpressionBody /alpha, beta/
> 
> How should I interpret these?
> 

Alpha, beta, etc are a short-hand for describing similar productions. They
can be expanded by replicating the parameterised production for each value
in the corresponding set. E.g.

   A(alpha) := B(alpha)

can be rewritten as:

   A_allowColon := B_allowColon
   A_noColon := B_noColon

The original description of this notation can be found here:

   http://www.mozilla.org/js/language/grammar14.html


> I also see other notation such as omega, tau, local, global, etc. Are
> these documented somewhere?

Yes, in the grammar

Jd




More information about the Es4-discuss mailing list