domenic at domenicdenicola.com (2014-02-10T22:30:50.461Z)
When I take the ECMAScript grammar and expand its abbreviations as outlined
in section 5.1.5, I get a grammar with lots of unreachable nonterminals
(i.e., symbols that can't appear in any sentential form derived from Script
or Module).
For instance, consider StrictFormalParameters. With its parameters Yield
and GeneratorParameter, it expands to 4 nonterminals:
```
StrictFormalParameters
StrictFormalParameters_Yield
StrictFormalParameters_GeneratorParameter
StrictFormalParameters_Yield_GeneratorParameter
```
(I use underscores to make the resulting names easier to read.)
In the unexpanded grammar, it's used in only 3 productions:
```
14.2:
ArrowFormalParameters :
( StrictFormalParameters )
14.3:
MethodDefinition[Yield] :
PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody }
14.4:
GeneratorMethod[Yield] :
* PropertyName[?Yield]
( StrictFormalParameters[Yield,GeneratorParameter] )
{ FunctionBody[Yield] }
```
The first two of these expand to productions that reference
```
StrictFormalParameters
```
and the last one expands to productions that reference
```
StrictFormalParameters_Yield_GeneratorParameter.
```
So
```
StrictFormalParameters_Yield and
StrictFormalParameters_GeneratorParameter
```
are never referenced, and are thus unreachable.
Is this intentional? Or should StrictFormalParameters have a "?Yield"
subscript in the 14.3 and 14.4 productions? (And while we're in the
neighborhood, should FunctionBody also have a "?Yield" subscript in those
productions?) If not, why not?
Similarly, I'm also wondering about the unreachability of
```
Statement_Yield
Declaration_Yield_Default
BindingIdentifier_Default_Yield
```
When I take the ECMAScript grammar and expand its abbreviations as outlined in section 5.1.5, I get a grammar with lots of unreachable nonterminals (i.e., symbols that can't appear in any sentential form derived from Script or Module). For instance, consider StrictFormalParameters. With its parameters Yield and GeneratorParameter, it expands to 4 nonterminals: StrictFormalParameters StrictFormalParameters_Yield StrictFormalParameters_GeneratorParameter StrictFormalParameters_Yield_GeneratorParameter (I use underscores to make the resulting names easier to read.) In the unexpanded grammar, it's used in only 3 productions: 14.2: ArrowFormalParameters : ( StrictFormalParameters ) 14.3: MethodDefinition[Yield] : PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } 14.4: GeneratorMethod[Yield] : * PropertyName[?Yield] ( StrictFormalParameters[Yield,GeneratorParameter] ) { FunctionBody[Yield] } The first two of these expand to productions that reference StrictFormalParameters and the last one expands to productions that reference StrictFormalParameters_Yield_GeneratorParameter. So StrictFormalParameters_Yield and StrictFormalParameters_GeneratorParameter are never referenced, and are thus unreachable. Is this intentional? Or should StrictFormalParameters have a "?Yield" subscript in the 14.3 and 14.4 productions? (And while we're in the neighborhood, should FunctionBody also have a "?Yield" subscript in those productions?) If not, why not? Similarly, I'm also wondering about the unreachability of Statement_Yield Declaration_Yield_Default BindingIdentifier_Default_Yield -Michael