archives

« Bugzilla Issues Index

#2985 — Use of "production"


The spec often conflates the notion of "production" with a program phrase _derived_ via a production. In many places this just results in a category error. For example:

8.3.1: "the production that is being evaluated"
9.2.2: "the production that is the value of [[Code]]"
9.2.5/6/7: "a parameter list production" and "a body production"
9.2.13: "for each production in functionsToInitialize"
9.4.4.7: "production 'formals'"

12.1.1: "if this production is contained in"
12.2.5.1: "if this production is present"
12.2.7.2: "let 'parameters' be the production" etc
12.2.9.2.1/2: "passing production as argument"
12.3.4.2: "takes a production"
12.5.4.1: "derives a production"
12.14.5.1: "derives a production" and "that production is substituted"

13.1.11: "code is the grammar production"; "if d is a X production"; "for each production"
13.2.1.1: "the declaration containing this production"
13.6.4.1: "derives a production"
13.7.1: "this production is nested"
13.8.1: dito

14.1.1: "the longest sequence of productions"
14.3.9: "let formalParameterList be the production"
14.4.15/16/17: "let body be the production"
14.5.3/11: "if ClassElement is the production"
14.6.1: "nonterminal is a parsed grammar production"
14.6.2: "HasProductionInTailPosition"

As Ch. 5 describes correctly, a production is a _rule_ of the grammar -- not a program _phrase_ derived by the grammar, nor a derivation of such a phrase. Consequently, a production cannot be "contained", "nested" or "substituted" in a piece of program, nor can it be "derived" or "evaluated". Likewise, the various algorithms are not actually parameterized over (or accumulate) productions, but phrases, pieces of code.

All these uses should be replaced by "phrase" or "code", "phrase/code derived with a production / matching a production", or "phrase/code being derivable with a production", respectively. Some places already use such wordings, but others don't.

(This terminological mistake was already present in the ES5 spec, but it now has proliferated significantly, especially in the static semantics.)


Further alternative wordings:
"parse tree"
"parse node"
"an instance of [production]"
"an instance of [nonterminal]"

(Each of these already appears in the spec, though not much.)


>
> (This terminological mistake was already present in the ES5 spec,

In fact, phrasing such as
"the production ... is evaluated as follows"
goes all the way back to ES1. ES5 added one or two more (mis-)usages, but almost all of the phrasings listed above first appeared in the 6th edition drafts.


deferring to ES7