March 1999 Draft
JavaScript 2.0
Notation
|
Tuesday, February 16, 1999
The main body of this proposal uses an informal syntax to describe language constructs. An example is the following:
<
VersionRange [:
Identifier] ,
... ,
VersionRange [:
Identifier] >
]..
[Version]VersionsAndRenames and VersionRange are the names of the grammar
rules. The black square brackets represent optional items, and the black ... together with its neighbors represents optional
repetition of zero or more items, so a VersionsAndRenames can have zero or more sets of VersionRange [:
Identifier]
separated by commas. A black | indicates that either its left or right alternative may be present, but not both; |'s have
the lowest metasymbol precedence. Syntactic tokens to be typed literally are in a bold blue
monospaced font
. Grammar nonterminals are in green italic and correspond to the nonterminals
in the grammar appendix.
The informal syntax descriptions sometimes list only the general or simplified syntax. Please refer to the grammar appendix for the actual syntax.
The LR(1) grammar rules have the format shown below. All of the grammar rules are listed in the grammar appendix.
...
Identifier,
...
IdentifierThis sample rule states that the nonterminal SampleList can represent one of four kinds of sequences of program tokens:
...
followed by some expansion of the nonterminal Identifier;,
and ...
and an expansion of the nonterminal
Identifier.A number of rules in the grammar occur in groups of analogous rules. Rather than list them individually, these groups have been summarized using the shorthand illustrated by the example below:
Metastatements such as
introduce grammar arguments and . If these arguments later parametrize the nonterminal on the left side of a rule, that rule is implicitly replicated into a set of rules in each of which a grammar argument is consistently substituted by one of its variants. For example,
=
AssignmentExpressionnormal,expands into the following four rules:
=
AssignmentExpressionnormal,allowIn=
AssignmentExpressionnormal,noIn=
AssignmentExpressionnormal,allowIn=
AssignmentExpressionnormal,noInAssignmentExpressionnormal,allowIn is now an unparametrized nonterminal and processed normally by the grammar.
Some of the expanded rules (such as the fourth one in the example above) may be unreachable from the starting nonterminal Program; these are ignored.
Waldemar Horwat Last modified Tuesday, February 16, 1999 |