|
JavaScript 2.0
Formal Description
|
Wednesday, May 12, 1999
The following pages present the formal syntax and semantics of JavaScript 2.0. The syntax notation and semantic notation pages explain the notation used for this description. A simple metalanguage based on a typed lambda calculus is used to specify the semantics.
The syntax and semantic pages are available in both HTML 4.0 and Microsoft Word 98 RTF formats. In the HTML versions each use of a grammar nonterminal or metalanguage value, type, or field is hyperlinked to its definition, making the HTML version preferred for browsing. On the other hand, the RTF version looks much better when printed. The fonts, colors, and other formatting of the various grammar and semantic elements are all encoded as CSS (in HTML) or Word (in RTF) styles and can be altered if desired.
The syntax and semantics pages are machine-generated from code supplied to a small engine that can type-check and execute the semantics directly. This engine is in the CVS tree at mozilla/js/semantics; the input files are at mozilla/js/semantics/JS20.
The source code is processed in the following stages:
Processing stage 2 is done as follows:
If an implementation encounters an error while lexing, it is permitted to either report the error immediately or defer it until the affected token would actually be used by the parser. This flexibility allows an implementation to do lexing at the same time it parses the source program.
Provide language prohibiting an identifier from immediately following a number. This will fall out of the revised definition of QuantityLiteral.
Show mapping from Token structures to parser grammar terminals (obvious, but needs to be written).
To be provided