'What is the meaning of an alternative according to ecma262?

I've been wondering what's the meaning of "alternative" in ecma262.

i've seen that the term "alternative" was used many times in the spec.

here are some examples:

quote taken from this section

so, in this example, the nonterminal ForStatement actually has four alternative right-hand sides.

quote taken from this section

A production that has multiple alternative definitions will typically have a distinct algorithm for each alternative

quote taken from this section

a production that has multiple alternative definitions will typically have for each alternative a distinct algorithm for each applicable named static semantic rule.

what does it mean "production that has multiple alternative definitions" ?

i assume that alternative mean the right hand side of a production, here is a simple picture that shows what i mean. enter image description here

on the picture we can see that the area covered by Pink is the whole Production.

and the area covered by Red is the Nonterminal

finally i'm assuming that the area covered by purple is the Alternative

A production that has multiple alternative definitions will typically have a distinct algorithm for each alternative

however it's still doesn't sounds right, because how can a one individual production have multiple alternatives ?



Solution 1:[1]

The word has its normal, English meaning:

offering or expressing a choice


So to take the first instance:

so, in this example, the nonterminal ForStatement actually has four alternative right-hand sides.

And just before that it lists them:

for ( LexicalDeclaration ; ) Statement
for ( LexicalDeclaration ; Expression ) Statement
for ( LexicalDeclaration Expression ; ) Statement
for ( LexicalDeclaration Expression ; Expression ) Statement 

Four alternative things you can put on the right-hand side of the keyword for.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Felix Kling