mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
722 lines
112 KiB
HTML
722 lines
112 KiB
HTML
<!DOCTYPE html><html lang="en-GB-oxendict"><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><meta property="og:image" content="https://tc39.es/ecmarkup/ecma-logo.png"><meta property="og:title" content="ECMAScript® 2026 Language Specification"><meta property="og:description" content="Introduction
|
||
This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invent">
|
||
<link rel="icon" href="../img/favicon.ico">
|
||
<link rel="stylesheet" href="../assets/css/ecmarkup.css"><link rel="stylesheet" href="../assets/css/print.css" media="print">
|
||
|
||
<title>ECMAScript® 2026 Language Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script><link rel="canonical" href="../#sec-notational-conventions"></head>
|
||
<body><div id="spec-container"><emu-clause id="sec-notational-conventions">
|
||
<h1><span class="secnum">5</span> Notational Conventions</h1>
|
||
|
||
<emu-clause id="sec-syntactic-and-lexical-grammars">
|
||
<h1><span class="secnum">5.1</span> Syntactic and Lexical Grammars</h1>
|
||
|
||
<emu-clause id="sec-context-free-grammars">
|
||
<h1><span class="secnum">5.1.1</span> Context-Free Grammars</h1>
|
||
<p>A <em>context-free grammar</em> consists of a number of <em>productions</em>. Each production has an abstract symbol called a <em>nonterminal</em> as its <em>left-hand side</em>, and a sequence of zero or more nonterminal and <em>terminal</em> symbols as its <em>right-hand side</em>. For each grammar, the terminal symbols are drawn from a specified alphabet.</p>
|
||
<p>A <dfn variants="chain productions" tabindex="-1">chain production</dfn> is a production that has exactly one nonterminal symbol on its right-hand side along with zero or more terminal symbols.</p>
|
||
<p>Starting from a sentence consisting of a single distinguished nonterminal, called the <dfn variants="goal symbols" tabindex="-1">goal symbol</dfn>, a given context-free grammar specifies a <em>language</em>, namely, the (perhaps infinite) set of possible sequences of terminal symbols that can result from repeatedly replacing any nonterminal in the sequence with a right-hand side of a production for which the nonterminal is the left-hand side.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-lexical-and-regexp-grammars">
|
||
<h1><span class="secnum">5.1.2</span> The Lexical and RegExp Grammars</h1>
|
||
<p>A <em>lexical grammar</em> for ECMAScript is given in clause <emu-xref href="#sec-ecmascript-language-lexical-grammar" id="_ref_24"><a href="ecmascript-language-lexical-grammar.html#sec-ecmascript-language-lexical-grammar">12</a></emu-xref>. This grammar has as its terminal symbols Unicode code points that conform to the rules for <emu-nt id="_ref_17614"><a href="ecmascript-language-source-code.html#prod-SourceCharacter">SourceCharacter</a></emu-nt> defined in <emu-xref href="#sec-source-text" id="_ref_25"><a href="ecmascript-language-source-code.html#sec-source-text">11.1</a></emu-xref>. It defines a set of productions, starting from the <emu-xref href="#sec-context-free-grammars" id="_ref_1110"><a href="notational-conventions.html#sec-context-free-grammars">goal symbol</a></emu-xref> <emu-nt id="_ref_17615"><a href="ecmascript-language-lexical-grammar.html#prod-InputElementDiv">InputElementDiv</a></emu-nt>, <emu-nt id="_ref_17616"><a href="ecmascript-language-lexical-grammar.html#prod-InputElementTemplateTail">InputElementTemplateTail</a></emu-nt>, <emu-nt id="_ref_17617"><a href="ecmascript-language-lexical-grammar.html#prod-InputElementRegExp">InputElementRegExp</a></emu-nt>, <emu-nt id="_ref_17618"><a href="ecmascript-language-lexical-grammar.html#prod-InputElementRegExpOrTemplateTail">InputElementRegExpOrTemplateTail</a></emu-nt>, or <emu-nt id="_ref_17619"><a href="ecmascript-language-lexical-grammar.html#prod-InputElementHashbangOrRegExp">InputElementHashbangOrRegExp</a></emu-nt>, that describe how sequences of such code points are translated into a sequence of input elements.</p>
|
||
<p>Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and are called ECMAScript <em>tokens</em>. These tokens are the <emu-xref href="#sec-keywords-and-reserved-words" id="_ref_1111"><a href="ecmascript-language-lexical-grammar.html#sec-keywords-and-reserved-words">reserved words</a></emu-xref>, identifiers, literals, and punctuators of the ECMAScript language. Moreover, line terminators, although not considered to be tokens, also become part of the stream of input elements and guide the process of automatic semicolon insertion (<emu-xref href="#sec-automatic-semicolon-insertion" id="_ref_26"><a href="ecmascript-language-lexical-grammar.html#sec-automatic-semicolon-insertion">12.10</a></emu-xref>). Simple white space and single-line comments are discarded and do not appear in the stream of input elements for the syntactic grammar. A <emu-nt id="_ref_17620"><a href="ecmascript-language-lexical-grammar.html#prod-MultiLineComment">MultiLineComment</a></emu-nt> (that is, a comment of the form <code>/*</code>…<code>*/</code> regardless of whether it spans more than one line) is likewise simply discarded if it contains no line terminator; but if a <emu-nt id="_ref_17621"><a href="ecmascript-language-lexical-grammar.html#prod-MultiLineComment">MultiLineComment</a></emu-nt> contains one or more line terminators, then it is replaced by a single line terminator, which becomes part of the stream of input elements for the syntactic grammar.</p>
|
||
<p>A <em>RegExp grammar</em> for ECMAScript is given in <emu-xref href="#sec-patterns" id="_ref_27"><a href="text-processing.html#sec-patterns">22.2.1</a></emu-xref>. This grammar also has as its terminal symbols the code points as defined by <emu-nt id="_ref_17622"><a href="ecmascript-language-source-code.html#prod-SourceCharacter">SourceCharacter</a></emu-nt>. It defines a set of productions, starting from the <emu-xref href="#sec-context-free-grammars" id="_ref_1112"><a href="notational-conventions.html#sec-context-free-grammars">goal symbol</a></emu-xref> <emu-nt id="_ref_17623"><a href="text-processing.html#prod-Pattern">Pattern</a></emu-nt>, that describe how sequences of code points are translated into regular expression patterns.</p>
|
||
<p>Productions of the lexical and RegExp grammars are distinguished by having two colons “<b>::</b>” as separating punctuation. The lexical and RegExp grammars share some productions.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-numeric-string-grammar">
|
||
<h1><span class="secnum">5.1.3</span> The Numeric String Grammar</h1>
|
||
<p>A <em>numeric string grammar</em> appears in <emu-xref href="#sec-tonumber-applied-to-the-string-type" id="_ref_28"><a href="abstract-operations.html#sec-tonumber-applied-to-the-string-type">7.1.4.1</a></emu-xref>. It has as its terminal symbols <emu-nt id="_ref_17624"><a href="ecmascript-language-source-code.html#prod-SourceCharacter">SourceCharacter</a></emu-nt>, and is used for translating Strings into numeric values starting from the <emu-xref href="#sec-context-free-grammars" id="_ref_1113"><a href="notational-conventions.html#sec-context-free-grammars">goal symbol</a></emu-xref> <emu-nt id="_ref_17625"><a href="abstract-operations.html#prod-StringNumericLiteral">StringNumericLiteral</a></emu-nt> (which is similar to but distinct from the <emu-xref href="#sec-literals-numeric-literals" id="_ref_29"><a href="ecmascript-language-lexical-grammar.html#sec-literals-numeric-literals">lexical grammar for numeric literals</a></emu-xref>).</p>
|
||
<p>Productions of the numeric string grammar are distinguished by having three colons “<b>:::</b>” as punctuation, and are never used for parsing source text.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-syntactic-grammar">
|
||
<h1><span class="secnum">5.1.4</span> The Syntactic Grammar</h1>
|
||
<p>The <em>syntactic grammar</em> for ECMAScript is given in clauses <emu-xref href="#sec-ecmascript-language-expressions" id="_ref_30"><a href="ecmascript-language-expressions.html#sec-ecmascript-language-expressions">13</a></emu-xref> through <emu-xref href="#sec-ecmascript-language-scripts-and-modules" id="_ref_31"><a href="ecmascript-language-scripts-and-modules.html#sec-ecmascript-language-scripts-and-modules">16</a></emu-xref>. This grammar has ECMAScript tokens defined by the lexical grammar as its terminal symbols (<emu-xref href="#sec-lexical-and-regexp-grammars" id="_ref_32"><a href="notational-conventions.html#sec-lexical-and-regexp-grammars">5.1.2</a></emu-xref>). It defines a set of productions, starting from two alternative <emu-xref href="#sec-context-free-grammars" id="_ref_1114"><a href="notational-conventions.html#sec-context-free-grammars">goal symbols</a></emu-xref> <emu-nt id="_ref_17626"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> and <emu-nt id="_ref_17627"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>, that describe how sequences of tokens form syntactically correct independent components of ECMAScript programs.</p>
|
||
<p>When a stream of code points is to be parsed as an ECMAScript <emu-nt id="_ref_17628"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17629"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>, it is first converted to a stream of input elements by repeated application of the lexical grammar; this stream of input elements is then parsed by a single application of the syntactic grammar. The input stream is syntactically in error if the tokens in the stream of input elements cannot be parsed as a single instance of the goal nonterminal (<emu-nt id="_ref_17630"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17631"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>), with no tokens left over.</p>
|
||
<p>When a parse is successful, it constructs a <em>parse tree</em>, a rooted tree structure in which each node is a <dfn variants="Parse Nodes" tabindex="-1">Parse Node</dfn>. Each Parse Node is an <em>instance</em> of a symbol in the grammar; it represents a span of the source text that can be derived from that symbol. The root node of the parse tree, representing the whole of the source text, is an instance of the parse's <emu-xref href="#sec-context-free-grammars" id="_ref_1115"><a href="notational-conventions.html#sec-context-free-grammars">goal symbol</a></emu-xref>. When a Parse Node is an instance of a nonterminal, it is also an instance of some production that has that nonterminal as its left-hand side. Moreover, it has zero or more <em>children</em>, one for each symbol on the production's right-hand side: each child is a Parse Node that is an instance of the corresponding symbol.</p>
|
||
<p>New Parse Nodes are instantiated for each invocation of the parser and never reused between parses even of identical source text. Parse Nodes are considered <dfn tabindex="-1">the same Parse Node</dfn> if and only if they represent the same span of source text, are instances of the same grammar symbol, and resulted from the same parser invocation.</p>
|
||
<emu-note><span class="note">Note 1</span><div class="note-contents">
|
||
<p>Parsing the same String multiple times will lead to different Parse Nodes. For example, consider:</p>
|
||
<pre><code class="javascript hljs"><span class="hljs-keyword">let</span> str = <span class="hljs-string">"1 + 1;"</span>;
|
||
<span class="hljs-built_in">eval</span>(str);
|
||
<span class="hljs-built_in">eval</span>(str);</code></pre>
|
||
<p>Each call to <code>eval</code> converts the value of <code>str</code> into <emu-xref href="#sec-source-text" id="_ref_1116"><a href="ecmascript-language-source-code.html#sec-source-text">ECMAScript source text</a></emu-xref> and performs an independent parse that creates its own separate tree of Parse Nodes. The trees are distinct even though each parse operates upon a source text that was derived from the same String value.</p>
|
||
</div></emu-note>
|
||
<emu-note><span class="note">Note 2</span><div class="note-contents">Parse Nodes are specification artefacts, and implementations are not required to use an analogous data structure.</div></emu-note>
|
||
<p>Productions of the syntactic grammar are distinguished by having just one colon “<b>:</b>” as punctuation.</p>
|
||
<p>The syntactic grammar as presented in clauses <emu-xref href="#sec-ecmascript-language-expressions" id="_ref_33"><a href="ecmascript-language-expressions.html#sec-ecmascript-language-expressions">13</a></emu-xref> through <emu-xref href="#sec-ecmascript-language-scripts-and-modules" id="_ref_34"><a href="ecmascript-language-scripts-and-modules.html#sec-ecmascript-language-scripts-and-modules">16</a></emu-xref> is not a complete account of which token sequences are accepted as a correct ECMAScript <emu-nt id="_ref_17632"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17633"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>. Certain additional token sequences are also accepted, namely, those that would be described by the grammar if only semicolons were added to the sequence in certain places (such as before line terminator characters). Furthermore, certain token sequences that are described by the grammar are not considered acceptable if a line terminator character appears in certain “awkward” places.</p>
|
||
<p>In certain cases, in order to avoid ambiguities, the syntactic grammar uses generalized productions that permit token sequences that do not form a valid ECMAScript <emu-nt id="_ref_17634"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17635"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>. For example, this technique is used for object literals and object destructuring patterns. In such cases a more restrictive <em>supplemental grammar</em> is provided that further restricts the acceptable token sequences. Typically, an <emu-xref href="#early-error" id="_ref_1117"><a href="error-handling-and-language-extensions.html#early-error">early error</a></emu-xref> rule will then state that, in certain contexts, "<var>P</var> <dfn id="must-cover" tabindex="-1">must cover</dfn> an <var>N</var>", where <var>P</var> is a Parse Node (an instance of the generalized production) and <var>N</var> is a nonterminal from the supplemental grammar. This means:</p>
|
||
<ol>
|
||
<li>The sequence of tokens originally matched by <var>P</var> is parsed again using <var>N</var> as the <emu-xref href="#sec-context-free-grammars" id="_ref_1118"><a href="notational-conventions.html#sec-context-free-grammars">goal symbol</a></emu-xref>. If <var>N</var> takes grammatical parameters, then they are set to the same values used when <var>P</var> was originally parsed.</li>
|
||
<li>If the sequence of tokens can be parsed as a single instance of <var>N</var>, with no tokens left over, then:
|
||
<ol>
|
||
<li>We refer to that instance of <var>N</var> (a Parse Node, unique for a given <var>P</var>) as "the <var>N</var> that is <dfn tabindex="-1">covered</dfn> by <var>P</var>".</li>
|
||
<li>All Early Error rules for <var>N</var> and its derived productions also apply to the <var>N</var> that is covered by <var>P</var>.</li>
|
||
</ol>
|
||
</li>
|
||
<li>Otherwise (if the parse fails), it is an early Syntax Error.</li>
|
||
</ol>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-grammar-notation" namespace="grammar-notation">
|
||
<h1><span class="secnum">5.1.5</span> Grammar Notation</h1>
|
||
|
||
<emu-clause id="sec-terminal-symbols">
|
||
<h1><span class="secnum">5.1.5.1</span> Terminal Symbols</h1>
|
||
<p>In the ECMAScript grammars, some terminal symbols are shown in <code>fixed-width</code> font. These are to appear in a source text exactly as written. All terminal symbol code points specified in this way are to be understood as the appropriate Unicode code points from the Basic Latin block, as opposed to any similar-looking code points from other Unicode ranges. A code point in a terminal symbol cannot be expressed by a <code>\</code> <emu-nt id="_ref_17636"><a href="ecmascript-language-lexical-grammar.html#prod-UnicodeEscapeSequence">UnicodeEscapeSequence</a></emu-nt>.</p>
|
||
<p>In grammars whose terminal symbols are individual Unicode code points (i.e., the lexical, RegExp, and numeric string grammars), a contiguous run of multiple fixed-width code points appearing in a production is a simple shorthand for the same sequence of code points, written as standalone terminal symbols.</p>
|
||
<p>For example, the production:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="HexIntegerLiteral" type="lexical" collapsed="">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-HexIntegerLiteral">HexIntegerLiteral</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="zxvbgn4l">
|
||
<emu-t>0x</emu-t>
|
||
<emu-nt id="_ref_17637"><a href="ecmascript-language-lexical-grammar.html#prod-HexDigits">HexDigits</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is a shorthand for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="HexIntegerLiteral" type="lexical" collapsed="" id="prod-grammar-notation-HexIntegerLiteral">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-HexIntegerLiteral">HexIntegerLiteral</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="tu0pitdu">
|
||
<emu-t>0</emu-t>
|
||
<emu-t>x</emu-t>
|
||
<emu-nt id="_ref_17638"><a href="ecmascript-language-lexical-grammar.html#prod-HexDigits">HexDigits</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>In contrast, in the syntactic grammar, a contiguous run of fixed-width code points is a single terminal symbol.</p>
|
||
<p>Terminal symbols come in two other forms:</p>
|
||
<ul>
|
||
<li>In the lexical and RegExp grammars, Unicode code points without a conventional printed representation are instead shown in the form "<ABBREV>" where "ABBREV" is a mnemonic for the code point or set of code points. These forms are defined in <emu-xref href="#sec-unicode-format-control-characters" title="" id="_ref_35"><a href="ecmascript-language-lexical-grammar.html#sec-unicode-format-control-characters">Unicode Format-Control Characters</a></emu-xref>, <emu-xref href="#sec-white-space" title="" id="_ref_36"><a href="ecmascript-language-lexical-grammar.html#sec-white-space">White Space</a></emu-xref>, and <emu-xref href="#sec-line-terminators" title="" id="_ref_37"><a href="ecmascript-language-lexical-grammar.html#sec-line-terminators">Line Terminators</a></emu-xref>.</li>
|
||
<li>In the syntactic grammar, certain terminal symbols (e.g. <emu-nt id="_ref_17639"><a href="ecmascript-language-lexical-grammar.html#prod-IdentifierName">IdentifierName</a></emu-nt> and <emu-nt id="_ref_17640"><a href="ecmascript-language-lexical-grammar.html#prod-RegularExpressionLiteral">RegularExpressionLiteral</a></emu-nt>) are shown in italics, as they refer to the nonterminals of the same name in the lexical grammar.</li>
|
||
</ul>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-nonterminal-symbols-and-productions">
|
||
<h1><span class="secnum">5.1.5.2</span> Nonterminal Symbols and Productions</h1>
|
||
<p>Nonterminal symbols are shown in <i>italic</i> type. The definition of a nonterminal (also called a “production”) is introduced by the name of the nonterminal being defined followed by one or more colons. (The number of colons indicates to which grammar the production belongs.) One or more alternative right-hand sides for the nonterminal then follow on succeeding lines. For example, the syntactic definition:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="WhileStatement" id="prod-grammar-notation-WhileStatement">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-WhileStatement">WhileStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="92j78-b5">
|
||
<emu-t>while</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17641"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17642"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>states that the nonterminal <emu-nt id="_ref_17643"><a href="notational-conventions.html#prod-grammar-notation-WhileStatement">WhileStatement</a></emu-nt> represents the token <code>while</code>, followed by a left parenthesis token, followed by an <emu-nt id="_ref_17644"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>, followed by a right parenthesis token, followed by a <emu-nt id="_ref_17645"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>. The occurrences of <emu-nt id="_ref_17646"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> and <emu-nt id="_ref_17647"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> are themselves nonterminals. As another example, the syntactic definition:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="ArgumentList" id="prod-grammar-notation-ArgumentList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-ArgumentList">ArgumentList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="1px9pijq">
|
||
<emu-nt id="_ref_17648"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="f_i_7oqe">
|
||
<emu-nt id="_ref_17649"><a href="notational-conventions.html#prod-grammar-notation-ArgumentList">ArgumentList</a></emu-nt>
|
||
<emu-t>,</emu-t>
|
||
<emu-nt id="_ref_17650"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>states that an <emu-nt id="_ref_17651"><a href="notational-conventions.html#prod-grammar-notation-ArgumentList">ArgumentList</a></emu-nt> may represent either a single <emu-nt id="_ref_17652"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt> or an <emu-nt id="_ref_17653"><a href="notational-conventions.html#prod-grammar-notation-ArgumentList">ArgumentList</a></emu-nt>, followed by a comma, followed by an <emu-nt id="_ref_17654"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>. This definition of <emu-nt id="_ref_17655"><a href="notational-conventions.html#prod-grammar-notation-ArgumentList">ArgumentList</a></emu-nt> is recursive, that is, it is defined in terms of itself. The result is that an <emu-nt id="_ref_17656"><a href="notational-conventions.html#prod-grammar-notation-ArgumentList">ArgumentList</a></emu-nt> may contain any positive number of arguments, separated by commas, where each argument expression is an <emu-nt id="_ref_17657"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>. Such recursive definitions of nonterminals are common.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-optional-symbols">
|
||
<h1><span class="secnum">5.1.5.3</span> Optional Symbols</h1>
|
||
<p>The subscripted suffix “<sub>opt</sub>”, which may appear after a terminal or nonterminal, indicates an optional symbol. The alternative containing the optional symbol actually specifies two right-hand sides, one that omits the optional element and one that includes it. This means that:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="VariableDeclaration">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="c5neqctp">
|
||
<emu-nt id="_ref_17658"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt optional="" id="_ref_17659"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is a convenient abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="VariableDeclaration">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uolyom43">
|
||
<emu-nt id="_ref_17660"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="ib7lg1vi">
|
||
<emu-nt id="_ref_17661"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt id="_ref_17662"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>and that:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="ForStatement">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="k8b-ryxj">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17663"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-nt optional="" id="_ref_17664"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-nt optional="" id="_ref_17665"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17666"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is a convenient abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="ForStatement">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ga1xtadp">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17667"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-nt optional="" id="_ref_17668"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17669"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="cs1gk7oq">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17670"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-nt id="_ref_17671"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-nt optional="" id="_ref_17672"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17673"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>which in turn is an abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="ForStatement" id="prod-grammar-notation-ForStatement">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="acc913te">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17674"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17675"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="1lbcl8ka">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17676"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-nt id="_ref_17677"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17678"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="6nfzjduy">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17679"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-nt id="_ref_17680"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17681"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="fyy9sdxo">
|
||
<emu-t>for</emu-t>
|
||
<emu-t>(</emu-t>
|
||
<emu-nt id="_ref_17682"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
|
||
<emu-nt id="_ref_17683"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
<emu-nt id="_ref_17684"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>)</emu-t>
|
||
<emu-nt id="_ref_17685"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>so, in this example, the nonterminal <emu-nt id="_ref_17686"><a href="notational-conventions.html#prod-grammar-notation-ForStatement">ForStatement</a></emu-nt> actually has four alternative right-hand sides.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-grammatical-parameters">
|
||
<h1><span class="secnum">5.1.5.4</span> Grammatical Parameters</h1>
|
||
<p>A production may be parameterized by a subscripted annotation of the form “<sub>[parameters]</sub>”, which may appear as a suffix to the nonterminal symbol defined by the production. “<sub>parameters</sub>” may be either a single name or a comma separated list of names. A parameterized production is shorthand for a set of productions defining all combinations of the parameter names, preceded by an underscore, appended to the parameterized nonterminal symbol. This means that:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList" params="Return">
|
||
<emu-nt params="Return"><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a><emu-mods><emu-params>[Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17687"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17688"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is a convenient abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17689"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17690"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="StatementList_Return">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList_Return">StatementList_Return</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17691"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17692"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>and that:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList" params="Return, In">
|
||
<emu-nt params="Return, In"><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a><emu-mods><emu-params>[Return, In]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17693"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17694"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is an abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17695"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17696"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="StatementList_Return">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList_Return">StatementList_Return</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17697"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17698"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="StatementList_In" id="prod-grammar-notation-StatementList_In">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList_In">StatementList_In</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17699"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17700"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="StatementList_Return_In" id="prod-grammar-notation-StatementList_Return_In">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList_Return_In">StatementList_Return_In</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17701"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17702"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>Multiple parameters produce a combinatoric number of productions, not all of which are necessarily referenced in a complete grammar.</p>
|
||
<p>References to nonterminals on the right-hand side of a production can also be parameterized. For example:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17703"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="q7ib3n22">
|
||
<emu-nt params="+In" id="_ref_17704"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a><emu-mods><emu-params>[+In]</emu-params></emu-mods></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is equivalent to saying:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17705"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="k6ggb0ke">
|
||
<emu-nt>ExpressionStatement_In</emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>and:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17706"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="cbr-bcps">
|
||
<emu-nt params="~In" id="_ref_17707"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a><emu-mods><emu-params>[~In]</emu-params></emu-mods></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is equivalent to:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17708"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17709"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>A nonterminal reference may have both a parameter list and an “<sub>opt</sub>” suffix. For example:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="VariableDeclaration">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="nj4iu70z">
|
||
<emu-nt id="_ref_17710"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt params="+In" optional="" id="_ref_17711"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[+In]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is an abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="VariableDeclaration">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uolyom43">
|
||
<emu-nt id="_ref_17712"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="atb3-ttx">
|
||
<emu-nt id="_ref_17713"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt>Initializer_In</emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>Prefixing a parameter name with “<sub>?</sub>” on a right-hand side nonterminal reference makes that parameter value dependent upon the occurrence of the parameter name on the reference to the current production's left-hand side symbol. For example:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="VariableDeclaration" params="In">
|
||
<emu-nt params="In"><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration">VariableDeclaration</a><emu-mods><emu-params>[In]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="3evhjud3">
|
||
<emu-nt id="_ref_17714"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt params="?In" id="_ref_17715"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[?In]</emu-params></emu-mods></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is an abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="VariableDeclaration" id="prod-grammar-notation-VariableDeclaration">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ib7lg1vi">
|
||
<emu-nt id="_ref_17716"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt id="_ref_17717"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="VariableDeclaration_In" id="prod-grammar-notation-VariableDeclaration_In">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-VariableDeclaration_In">VariableDeclaration_In</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="atb3-ttx">
|
||
<emu-nt id="_ref_17718"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
|
||
<emu-nt>Initializer_In</emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>If a right-hand side alternative is prefixed with “[+parameter]” that alternative is only available if the named parameter was used in referencing the production's nonterminal symbol. If a right-hand side alternative is prefixed with “[~parameter]” that alternative is only available if the named parameter was <em>not</em> used in referencing the production's nonterminal symbol. This means that:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList" params="Return">
|
||
<emu-nt params="Return"><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a><emu-mods><emu-params>[Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="pxk-qj7n" constraints="+Return"><emu-constraints>[+Return]</emu-constraints>
|
||
<emu-nt id="_ref_17719"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17720"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is an abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17721"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="StatementList_Return">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList_Return">StatementList_Return</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17722"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17723"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>and that:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList" params="Return">
|
||
<emu-nt params="Return"><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a><emu-mods><emu-params>[Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="mr68necj" constraints="~Return"><emu-constraints>[~Return]</emu-constraints>
|
||
<emu-nt id="_ref_17724"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17725"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>is an abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="StatementList" id="prod-grammar-notation-StatementList">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qm95e4wi">
|
||
<emu-nt id="_ref_17726"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17727"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="StatementList_Return" id="prod-grammar-notation-StatementList_Return">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-StatementList_Return">StatementList_Return</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gsqkt2bv">
|
||
<emu-nt id="_ref_17728"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-one-of">
|
||
<h1><span class="secnum">5.1.5.5</span> one of</h1>
|
||
<p>When the words “<b>one of</b>” follow the colon(s) in a grammar definition, they signify that each of the terminal symbols on the following line or lines is an alternative definition. For example, the lexical grammar for ECMAScript contains the production:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="NonZeroDigit" type="lexical" oneof="">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-NonZeroDigit">NonZeroDigit</a></emu-nt> <emu-geq>::</emu-geq> <emu-oneof>one of</emu-oneof> <emu-rhs><emu-t>1</emu-t> <emu-t>2</emu-t> <emu-t>3</emu-t> <emu-t>4</emu-t> <emu-t>5</emu-t> <emu-t>6</emu-t> <emu-t>7</emu-t> <emu-t>8</emu-t> <emu-t>9</emu-t></emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>which is merely a convenient abbreviation for:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="NonZeroDigit" type="lexical" id="prod-grammar-notation-NonZeroDigit">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-NonZeroDigit">NonZeroDigit</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="ksql3txo">
|
||
<emu-t>1</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="xkcxbwmk">
|
||
<emu-t>2</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="7gu2shc1">
|
||
<emu-t>3</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="woxkczx2">
|
||
<emu-t>4</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="j83vdwqk">
|
||
<emu-t>5</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="c2shfb68">
|
||
<emu-t>6</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="6l4hpim_">
|
||
<emu-t>7</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="elvyw2lo">
|
||
<emu-t>8</emu-t>
|
||
</emu-rhs>
|
||
<emu-rhs a="fj9dcfsf">
|
||
<emu-t>9</emu-t>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-empty">
|
||
<h1><span class="secnum">5.1.5.6</span> [empty]</h1>
|
||
<p>If the phrase “[empty]” appears as the right-hand side of a production, it indicates that the production's right-hand side contains no terminals or nonterminals.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-lookahead-restrictions">
|
||
<h1><span class="secnum">5.1.5.7</span> Lookahead Restrictions</h1>
|
||
<p>If the phrase “[lookahead = <var>seq</var>]” appears in the right-hand side of a production, it indicates that the production may only be used if the token sequence <var>seq</var> is a prefix of the immediately following input token sequence. Similarly, “[lookahead ∈ <var>set</var>]”, where <var>set</var> is a <emu-xref href="#finite" id="_ref_17367"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> non-empty set of token sequences, indicates that the production may only be used if some element of <var>set</var> is a prefix of the immediately following token sequence. For convenience, the set can also be written as a nonterminal, in which case it represents the set of all token sequences to which that nonterminal could expand. It is considered an editorial error if the nonterminal could expand to infinitely many distinct token sequences.</p>
|
||
<p>These conditions may be negated. “[lookahead ≠ <var>seq</var>]” indicates that the containing production may only be used if <var>seq</var> is <em>not</em> a prefix of the immediately following input token sequence, and “[lookahead ∉ <var>set</var>]” indicates that the production may only be used if <em>no</em> element of <var>set</var> is a prefix of the immediately following token sequence.</p>
|
||
<p>As an example, given the definitions:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="DecimalDigit" type="lexical" oneof="" id="prod-grammar-notation-DecimalDigit">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-DecimalDigit">DecimalDigit</a></emu-nt> <emu-geq>::</emu-geq> <emu-oneof>one of</emu-oneof> <emu-rhs><emu-t>0</emu-t> <emu-t>1</emu-t> <emu-t>2</emu-t> <emu-t>3</emu-t> <emu-t>4</emu-t> <emu-t>5</emu-t> <emu-t>6</emu-t> <emu-t>7</emu-t> <emu-t>8</emu-t> <emu-t>9</emu-t></emu-rhs>
|
||
</emu-production>
|
||
<emu-production name="DecimalDigits" type="lexical" id="prod-grammar-notation-DecimalDigits">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-DecimalDigits">DecimalDigits</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="s4me4hlz">
|
||
<emu-nt id="_ref_17729"><a href="notational-conventions.html#prod-grammar-notation-DecimalDigit">DecimalDigit</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="nyugv7lw">
|
||
<emu-nt id="_ref_17730"><a href="notational-conventions.html#prod-grammar-notation-DecimalDigits">DecimalDigits</a></emu-nt>
|
||
<emu-nt id="_ref_17731"><a href="notational-conventions.html#prod-grammar-notation-DecimalDigit">DecimalDigit</a></emu-nt>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>the definition:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="LookaheadExample" type="lexical" id="prod-grammar-notation-LookaheadExample">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-LookaheadExample">LookaheadExample</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="addtyof5">
|
||
<emu-t>n</emu-t>
|
||
<emu-gann>[lookahead ∉ { <emu-t>1</emu-t>, <emu-t>3</emu-t>, <emu-t>5</emu-t>, <emu-t>7</emu-t>, <emu-t>9</emu-t> }]</emu-gann>
|
||
<emu-nt id="_ref_17732"><a href="notational-conventions.html#prod-grammar-notation-DecimalDigits">DecimalDigits</a></emu-nt>
|
||
</emu-rhs>
|
||
<emu-rhs a="ol8hhyg0">
|
||
<emu-nt id="_ref_17733"><a href="notational-conventions.html#prod-grammar-notation-DecimalDigit">DecimalDigit</a></emu-nt>
|
||
<emu-gann>[lookahead ∉ <emu-nt id="_ref_17734"><a href="notational-conventions.html#prod-grammar-notation-DecimalDigit">DecimalDigit</a></emu-nt>]</emu-gann>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>matches either the letter <code>n</code> followed by one or more decimal digits the first of which is even, or a decimal digit not followed by another decimal digit.</p>
|
||
<p>Note that when these phrases are used in the syntactic grammar, it may not be possible to unambiguously identify the immediately following token sequence because determining later tokens requires knowing which lexical <emu-xref href="#sec-context-free-grammars" id="_ref_17368"><a href="notational-conventions.html#sec-context-free-grammars">goal symbol</a></emu-xref> to use at later positions. As such, when these are used in the syntactic grammar, it is considered an editorial error for a token sequence <var>seq</var> to appear in a lookahead restriction (including as part of a set of sequences) if the choices of lexical <emu-xref href="#sec-context-free-grammars" id="_ref_17369"><a href="notational-conventions.html#sec-context-free-grammars">goal symbols</a></emu-xref> to use could change whether or not <var>seq</var> would be a prefix of the resulting token sequence.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-no-lineterminator-here">
|
||
<h1><span class="secnum">5.1.5.8</span> [no <emu-nt id="_ref_17735"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</h1>
|
||
<p>If the phrase “[no <emu-nt id="_ref_17736"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]” appears in the right-hand side of a production of the syntactic grammar, it indicates that the production is <em>a restricted production</em>: it may not be used if a <emu-nt id="_ref_17737"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> occurs in the input stream at the indicated position. For example, the production:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="ThrowStatement" id="prod-grammar-notation-ThrowStatement">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-ThrowStatement">ThrowStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="_07izqvp">
|
||
<emu-t>throw</emu-t>
|
||
<emu-gann>[no <emu-nt id="_ref_17738"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</emu-gann>
|
||
<emu-nt id="_ref_17739"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
|
||
<emu-t>;</emu-t>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>indicates that the production may not be used if a <emu-nt id="_ref_17740"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> occurs in the script between the <code>throw</code> token and the <emu-nt id="_ref_17741"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</p>
|
||
<p>Unless the presence of a <emu-nt id="_ref_17742"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> is forbidden by a restricted production, any number of occurrences of <emu-nt id="_ref_17743"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> may appear between any two consecutive tokens in the stream of input elements without affecting the syntactic acceptability of the script.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-but-not">
|
||
<h1><span class="secnum">5.1.5.9</span> but not</h1>
|
||
<p>The right-hand side of a production may specify that certain expansions are not permitted by using the phrase “<b>but not</b>” and then indicating the expansions to be excluded. For example, the production:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="Identifier" type="lexical" id="prod-grammar-notation-Identifier">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-Identifier">Identifier</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="v6xddc2h">
|
||
<emu-nt id="_ref_17744"><a href="ecmascript-language-lexical-grammar.html#prod-IdentifierName">IdentifierName</a></emu-nt> <emu-gmod>but not <emu-nt id="_ref_17745"><a href="ecmascript-language-lexical-grammar.html#prod-ReservedWord">ReservedWord</a></emu-nt></emu-gmod>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>means that the nonterminal <emu-nt id="_ref_17746"><a href="notational-conventions.html#prod-grammar-notation-Identifier">Identifier</a></emu-nt> may be replaced by any sequence of code points that could replace <emu-nt id="_ref_17747"><a href="ecmascript-language-lexical-grammar.html#prod-IdentifierName">IdentifierName</a></emu-nt> provided that the same sequence of code points could not replace <emu-nt id="_ref_17748"><a href="ecmascript-language-lexical-grammar.html#prod-ReservedWord">ReservedWord</a></emu-nt>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-descriptive-phrases">
|
||
<h1><span class="secnum">5.1.5.10</span> Descriptive Phrases</h1>
|
||
<p>Finally, a few nonterminal symbols are described by a descriptive phrase in sans-serif type in cases where it would be impractical to list all the alternatives:</p>
|
||
<emu-grammar type="definition" example=""><emu-production name="SourceCharacter" type="lexical" id="prod-grammar-notation-SourceCharacter">
|
||
<emu-nt><a href="notational-conventions.html#prod-grammar-notation-SourceCharacter">SourceCharacter</a></emu-nt> <emu-geq>::</emu-geq> <emu-rhs a="xks4vqzw">
|
||
<emu-gprose>any Unicode code point</emu-gprose>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-algorithm-conventions">
|
||
<h1><span class="secnum">5.2</span> Algorithm Conventions</h1>
|
||
<p>The specification often uses a numbered list to specify steps in an algorithm. These algorithms are used to precisely specify the required semantics of ECMAScript language constructs. The algorithms are not intended to imply the use of any specific implementation technique. In practice, there may be more efficient algorithms available to implement a given feature.</p>
|
||
<p>Algorithms may be explicitly parameterized with an ordered, comma-separated sequence of alias names which may be used within the algorithm steps to reference the argument passed in that position. Optional parameters are denoted with surrounding brackets ([ , <var>name</var> ]) and are no different from required parameters within algorithm steps. A rest parameter may appear at the end of a parameter list, denoted with leading ellipsis (, ...<var>name</var>). The rest parameter captures all of the arguments provided following the required and optional parameters into a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_1119"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>. If there are no such additional arguments, that <emu-xref href="#sec-list-and-record-specification-type" id="_ref_1120"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> is empty.</p>
|
||
<p>Algorithm steps may be subdivided into sequential substeps. Substeps are indented and may themselves be further divided into indented substeps. Outline numbering conventions are used to identify substeps with the first level of substeps labelled with lowercase alphabetic characters and the second level of substeps labelled with lowercase roman numerals. If more than three levels are required these rules repeat with the fourth level using numeric labels. For example:</p>
|
||
<emu-alg example=""><ol><li>Top-level step<ol><li>Substep.</li><li>Substep.<ol><li>Subsubstep.<ol><li>Subsubsubstep<ol><li>Subsubsubsubstep<ol><li>Subsubsubsubsubstep</li></ol></li></ol></li></ol></li></ol></li></ol></li></ol></emu-alg>
|
||
<p>A step or substep may be written as an “if” predicate that conditions its substeps. In this case, the substeps are only applied if the predicate is true. If a step or substep begins with the word “else”, it is a predicate that is the negation of the preceding “if” predicate step at the same level.</p>
|
||
<p>A step may specify the iterative application of its substeps.</p>
|
||
<p>A step that begins with “<dfn id="assert" tabindex="-1">Assert</dfn>:” asserts an invariant condition of its algorithm. Such assertions are used to make explicit algorithmic invariants that would otherwise be implicit. Such assertions add no additional semantic requirements and hence need not be checked by an implementation. They are used simply to clarify algorithms.</p>
|
||
<p>Algorithm steps may declare named aliases for any value using the form “Let <var>x</var> be <var>someValue</var>”. These aliases are reference-like in that both <var>x</var> and <var>someValue</var> refer to the same underlying data and modifications to either are visible to both. Algorithm steps that want to avoid this reference-like behaviour should explicitly make a copy of the right-hand side: “Let <var>x</var> be a copy of <var>someValue</var>” creates a shallow copy of <var>someValue</var>.</p>
|
||
<p>Once declared, an alias may be referenced in any subsequent steps and must not be referenced from steps prior to the alias's declaration. Aliases may be modified using the form “Set <var>x</var> to <var>someOtherValue</var>”.</p>
|
||
|
||
<emu-clause id="sec-evaluation-order">
|
||
<h1><span class="secnum">5.2.1</span> Evaluation Order</h1>
|
||
<p>When complex expressions appear in algorithm steps, these are to be understood as being evaluated in a left-to-right, inside-to-outside order. For example, the step</p>
|
||
<emu-alg example=""><ol><li>Return A(B(), C.<var class="field">[[D]]</var>) + E(F()).</li></ol></emu-alg>
|
||
<p>is equivalent to</p>
|
||
<emu-alg example=""><ol><li>Let <var>tmp1</var> be B().</li><li>Let <var>tmp2</var> be C.<var class="field">[[D]]</var>.</li><li>Let <var>tmp3</var> be A(<var>tmp1</var>, <var>tmp2</var>).</li><li>Let <var>tmp4</var> be F().</li><li>Let <var>tmp5</var> be E(<var>tmp4</var>).</li><li>Let <var>tmp6</var> be <var>tmp3</var> + <var>tmp5</var>.</li><li>Return <var>tmp6</var>.</li></ol></emu-alg>
|
||
<p>where the various <var>tmpN</var> aliases are ephemeral and visible only in these steps.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-algorithm-conventions-abstract-operations">
|
||
<h1><span class="secnum">5.2.2</span> Abstract Operations</h1>
|
||
<p>In order to facilitate their use in multiple parts of this specification, some algorithms, called <dfn tabindex="-1">abstract operations</dfn>, are named and written in parameterized functional form so that they may be referenced by name from within other algorithms. Abstract operations are typically referenced using a functional application style such as OperationName(<var>arg1</var>, <var>arg2</var>). Some abstract operations are treated as polymorphically dispatched methods of class-like specification abstractions. Such method-like abstract operations are typically referenced using a method application style such as <var>someValue</var>.OperationName(<var>arg1</var>, <var>arg2</var>).</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-algorithm-conventions-syntax-directed-operations">
|
||
<h1><span class="secnum">5.2.3</span> Syntax-Directed Operations</h1>
|
||
<p>A <dfn variants="syntax-directed operations" tabindex="-1">syntax-directed operation</dfn> is a named operation whose definition consists of algorithms, each of which is associated with one or more productions from one of the ECMAScript grammars. A production that has multiple alternative definitions will typically have a distinct algorithm for each alternative. When an algorithm is associated with a grammar production, it may reference the terminal and nonterminal symbols of the production alternative as if they were parameters of the algorithm. When used in this manner, nonterminal symbols refer to the actual alternative definition that is matched when parsing the source text. The <dfn oldids="sec-static-semantics-sourcetext" tabindex="-1"><span id="sec-static-semantics-sourcetext"></span>source text matched by</dfn> a grammar production or <emu-xref href="#sec-syntactic-grammar" id="_ref_1121"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> derived from it is the portion of the source text that starts at the beginning of the first terminal that participated in the match and ends at the end of the last terminal that participated in the match.</p>
|
||
<p>When an algorithm is associated with a production alternative, the alternative is typically shown without any “[ ]” grammar annotations. Such annotations should only affect the syntactic recognition of the alternative and have no effect on the associated semantics for the alternative.</p>
|
||
<p>Syntax-directed operations are invoked with a parse node and, optionally, other parameters by using the conventions on steps <emu-xref href="#step-sdo-invocation-example-1" id="_ref_38"><a href="notational-conventions.html#step-sdo-invocation-example-1">1</a></emu-xref>, <emu-xref href="#step-sdo-invocation-example-2" id="_ref_39"><a href="notational-conventions.html#step-sdo-invocation-example-2">3</a></emu-xref>, and <emu-xref href="#step-sdo-invocation-example-3" id="_ref_40"><a href="notational-conventions.html#step-sdo-invocation-example-3">4</a></emu-xref> in the following algorithm:</p>
|
||
<emu-alg example=""><ol><li id="step-sdo-invocation-example-1">Let <var>status</var> be SyntaxDirectedOperation of <emu-nt>SomeNonTerminal</emu-nt>.</li><li>Let <var>someParseNode</var> be the parse of some source text.</li><li id="step-sdo-invocation-example-2">Perform SyntaxDirectedOperation of <var>someParseNode</var>.</li><li id="step-sdo-invocation-example-3">Perform SyntaxDirectedOperation of <var>someParseNode</var> with argument <emu-val>"value"</emu-val>.</li></ol></emu-alg>
|
||
<p>Unless explicitly specified otherwise, all <emu-xref href="#sec-context-free-grammars" id="_ref_1122"><a href="notational-conventions.html#sec-context-free-grammars">chain productions</a></emu-xref> have an implicit definition for every operation that might be applied to that production's left-hand side nonterminal. The implicit definition simply reapplies the same operation with the same parameters, if any, to the <emu-xref href="#sec-context-free-grammars" id="_ref_1123"><a href="notational-conventions.html#sec-context-free-grammars">chain production</a></emu-xref>'s sole right-hand side nonterminal and then returns the result. For example, assume that some algorithm has a step of the form: “Return <emu-xref aoid="Evaluation" id="_ref_1124"><a href="syntax-directed-operations.html#sec-evaluation">Evaluation</a></emu-xref> of <emu-nt id="_ref_17749"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>” and that there is a production:</p>
|
||
<emu-grammar example=""><emu-production name="Block">
|
||
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="z4ljp0ar">
|
||
<emu-t>{</emu-t>
|
||
<emu-nt id="_ref_17750"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
|
||
<emu-t>}</emu-t>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<p>but the <emu-xref aoid="Evaluation" id="_ref_1125"><a href="syntax-directed-operations.html#sec-evaluation">Evaluation</a></emu-xref> operation does not associate an algorithm with that production. In that case, the <emu-xref aoid="Evaluation" id="_ref_1126"><a href="syntax-directed-operations.html#sec-evaluation">Evaluation</a></emu-xref> operation implicitly includes an association of the form:</p>
|
||
<p><b>Runtime Semantics: <emu-xref aoid="Evaluation" id="_ref_1127"><a href="syntax-directed-operations.html#sec-evaluation">Evaluation</a></emu-xref></b></p>
|
||
<emu-grammar example=""><emu-production name="Block" collapsed="">
|
||
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="z4ljp0ar">
|
||
<emu-t>{</emu-t>
|
||
<emu-nt id="_ref_17751"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
|
||
<emu-t>}</emu-t>
|
||
</emu-rhs>
|
||
</emu-production>
|
||
</emu-grammar>
|
||
<emu-alg example=""><ol><li>Return <emu-xref aoid="Evaluation" id="_ref_1128"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_17752"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>.</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-runtime-semantics">
|
||
<h1><span class="secnum">5.2.4</span> Runtime Semantics</h1>
|
||
<p>Algorithms which specify semantics that must be called at runtime are called <dfn tabindex="-1">runtime semantics</dfn>. Runtime semantics are defined by <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1129"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref> or <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_1130"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operations</a></emu-xref>.</p>
|
||
|
||
<emu-clause id="sec-completion-ao" type="abstract operation" aoid="Completion">
|
||
<h1><span class="secnum">5.2.4.1</span> Completion ( <var>completionRecord</var> )</h1>
|
||
<p>The abstract operation Completion takes argument <var>completionRecord</var> (a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1131"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1132"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>. It is used to emphasize that a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1133"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> is being returned. It performs the following steps when called:</p>
|
||
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_1134"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>completionRecord</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1135"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>.</li><li>Return <var>completionRecord</var>.</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-throw-an-exception">
|
||
<h1><span class="secnum">5.2.4.2</span> Throw an Exception</h1>
|
||
<p>Algorithms steps that say to throw an exception, such as</p>
|
||
<emu-alg example=""><ol><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
|
||
<p>mean the same things as:</p>
|
||
<emu-alg example=""><ol><li>Return <emu-xref aoid="ThrowCompletion" id="_ref_1136"><a href="ecmascript-data-types-and-values.html#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>TypeError</emu-val> object).</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-shorthands-for-unwrapping-completion-records" oldids="sec-returnifabrupt"><span id="sec-returnifabrupt"></span>
|
||
<h1><span class="secnum">5.2.4.3</span> Shorthands for Unwrapping Completion Records</h1>
|
||
<p>Prefix <code>?</code> and <code>!</code> are used as shorthands which unwrap <emu-xref href="#sec-completion-record-specification-type" id="_ref_1137"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Records</a></emu-xref>. <code>?</code> is used to propagate an <emu-xref href="#sec-completion-record-specification-type" id="_ref_1138"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> to the caller, or otherwise to unwrap a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1139"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref>. <code>!</code> is used to assert that a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1140"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> is normal and unwrap it. Formally, the step</p>
|
||
<emu-alg example=""><ol><li>Let <var>result</var> be ? <var>record</var>.</li></ol></emu-alg>
|
||
<p>is equivalent to</p>
|
||
<emu-alg example=""><ol><li><emu-xref href="#assert" id="_ref_1141"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>record</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1142"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>.</li><li>If <var>record</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_1143"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return <var>record</var>.</li><li>Let <var>result</var> be <var>record</var>.<var class="field">[[Value]]</var>.</li></ol></emu-alg>
|
||
<p>Likewise, the step</p>
|
||
<emu-alg example=""><ol><li>Let <var>result</var> be ! <var>record</var>.</li></ol></emu-alg>
|
||
<p>is equivalent to</p>
|
||
<emu-alg example=""><ol><li><emu-xref href="#assert" id="_ref_1144"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>record</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1145"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref>.</li><li>Let <var>result</var> be <var>record</var>.<var class="field">[[Value]]</var>.</li></ol></emu-alg>
|
||
<p>When <code>?</code> or <code>!</code> is used in any other context, first apply the rewrite given in <emu-xref href="#sec-evaluation-order" title="" id="_ref_41"><a href="notational-conventions.html#sec-evaluation-order">Evaluation Order</a></emu-xref> until this rule can be applied, then apply this rule. For example, the step</p>
|
||
<emu-alg example=""><ol><li>Perform AO(? Other()).</li></ol></emu-alg>
|
||
<p>can be rewritten to</p>
|
||
<emu-alg example=""><ol><li>Let <var>tmp1</var> be Other().</li><li>Let <var>tmp2</var> be ? <var>tmp1</var>.</li><li>Perform AO(<var>tmp2</var>).</li></ol></emu-alg>
|
||
<p>which in turn expands to</p>
|
||
<emu-alg example=""><ol><li>Let <var>tmp1</var> be Other().</li><li><emu-xref href="#assert" id="_ref_1146"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>tmp1</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1147"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>.</li><li>If <var>tmp1</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_1148"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return <var>tmp1</var>.</li><li>Let <var>tmp2</var> be <var>tmp1</var>.<var class="field">[[Value]]</var>.</li><li>Perform AO(<var>tmp2</var>).</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-implicit-normal-completion" oldids="sec-implicit-completion-values"><span id="sec-implicit-completion-values"></span>
|
||
<h1><span class="secnum">5.2.4.4</span> Implicit Normal Completion</h1>
|
||
<p>In algorithms within <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1149"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref> which are declared to return a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1150"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>, and within all built-in functions, the returned value is first passed to <emu-xref aoid="NormalCompletion" id="_ref_1151"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>, and the result is used instead. This rule does not apply within the <emu-xref aoid="Completion" id="_ref_1152"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref> algorithm or when the value being returned is clearly marked as a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1153"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> in that step; these cases are:</p>
|
||
<ul>
|
||
<li>when the result of applying <emu-xref aoid="Completion" id="_ref_1154"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>, <emu-xref aoid="NormalCompletion" id="_ref_1155"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>, <emu-xref aoid="ThrowCompletion" id="_ref_1156"><a href="ecmascript-data-types-and-values.html#sec-throwcompletion">ThrowCompletion</a></emu-xref>, or <emu-xref aoid="ReturnCompletion" id="_ref_1157"><a href="ecmascript-data-types-and-values.html#sec-returncompletion">ReturnCompletion</a></emu-xref> is directly returned</li>
|
||
<li>when the result of constructing a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1158"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> is directly returned</li>
|
||
</ul>
|
||
<p>It is an editorial error if a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1159"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> is returned from such an abstract operation through any other means. For example, within these <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1160"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref>,</p>
|
||
<emu-alg example=""><ol><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
|
||
<p>means the same things as any of</p>
|
||
<emu-alg example=""><ol><li>Return <emu-xref aoid="NormalCompletion" id="_ref_1161"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>true</emu-val>).</li></ol></emu-alg>
|
||
<p>or</p>
|
||
<emu-alg example=""><ol><li>Let <var>completion</var> be <emu-xref aoid="NormalCompletion" id="_ref_1162"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>true</emu-val>).</li><li>Return <emu-xref aoid="Completion" id="_ref_1163"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<var>completion</var>).</li></ol></emu-alg>
|
||
<p>or</p>
|
||
<emu-alg example=""><ol><li>Return <emu-xref href="#sec-completion-record-specification-type" id="_ref_1164"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> { <var class="field">[[Type]]</var>: <emu-const>normal</emu-const>, <var class="field">[[Value]]</var>: <emu-val>true</emu-val>, <var class="field">[[Target]]</var>: <emu-const>empty</emu-const> }.</li></ol></emu-alg>
|
||
<p>Note that, through the ReturnIfAbrupt expansion, the following example is allowed, as within the expanded steps, the result of applying <emu-xref aoid="Completion" id="_ref_1165"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref> is returned directly in the abrupt case and the implicit <emu-xref aoid="NormalCompletion" id="_ref_1166"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref> application occurs after unwrapping in the normal case.</p>
|
||
<emu-alg example=""><ol><li>Return ? <var>completion</var>.</li></ol></emu-alg>
|
||
<p>The following example would be an editorial error because a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1167"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> is being returned without being annotated in that step.</p>
|
||
<emu-alg example=""><ol><li>Let <var>completion</var> be <emu-xref aoid="NormalCompletion" id="_ref_1168"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>true</emu-val>).</li><li>Return <var>completion</var>.</li></ol></emu-alg>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-static-semantic-rules">
|
||
<h1><span class="secnum">5.2.5</span> Static Semantics</h1>
|
||
<p>Context-free grammars are not sufficiently powerful to express all the rules that define whether a stream of input elements form a valid ECMAScript <emu-nt id="_ref_17753"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17754"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt> that may be evaluated. In some situations additional rules are needed that may be expressed using either ECMAScript algorithm conventions or prose requirements. Such rules are always associated with a production of a grammar and are called the <dfn tabindex="-1">static semantics</dfn> of the production.</p>
|
||
<p>Static Semantic Rules have names and typically are defined using an algorithm. Named Static Semantic Rules are associated with grammar productions and a production that has multiple alternative definitions will typically have for each alternative a distinct algorithm for each applicable named static semantic rule.</p>
|
||
<p>A special kind of static semantic rule is an <dfn id="early-error-rule" tabindex="-1">Early Error Rule</dfn>. <emu-xref href="#early-error" id="_ref_1169"><a href="error-handling-and-language-extensions.html#early-error">Early error</a></emu-xref> rules define <emu-xref href="#early-error" id="_ref_1170"><a href="error-handling-and-language-extensions.html#early-error">early error</a></emu-xref> conditions (see clause <emu-xref href="#sec-error-handling-and-language-extensions" id="_ref_42"><a href="error-handling-and-language-extensions.html#sec-error-handling-and-language-extensions">17</a></emu-xref>) that are associated with specific grammar productions. <emu-xref aoid="Evaluation" id="_ref_1171"><a href="syntax-directed-operations.html#sec-evaluation">Evaluation</a></emu-xref> of most <emu-xref href="#early-error" id="_ref_1172"><a href="error-handling-and-language-extensions.html#early-error">early error</a></emu-xref> rules are not explicitly invoked within the algorithms of this specification. A conforming implementation must, prior to the first evaluation of a <emu-nt id="_ref_17755"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17756"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>, validate all of the <emu-xref href="#early-error" id="_ref_1173"><a href="error-handling-and-language-extensions.html#early-error">early error</a></emu-xref> rules of the productions used to parse that <emu-nt id="_ref_17757"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17758"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>. If any of the <emu-xref href="#early-error" id="_ref_1174"><a href="error-handling-and-language-extensions.html#early-error">early error</a></emu-xref> rules are violated the <emu-nt id="_ref_17759"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt> or <emu-nt id="_ref_17760"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt> is invalid and cannot be evaluated.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-mathematical-operations">
|
||
<h1><span class="secnum">5.2.6</span> Mathematical Operations</h1>
|
||
<p>This specification makes reference to these kinds of numeric values:</p>
|
||
<ul>
|
||
<li><dfn id="mathematical-value" variants="mathematical value,mathematical values" tabindex="-1">Mathematical values</dfn>: Arbitrary real numbers, used as the default numeric type.</li>
|
||
<li><dfn id="extended-mathematical-value" variants="extended mathematical value,extended mathematical values" tabindex="-1">Extended mathematical values</dfn>: <emu-xref href="#mathematical-value" id="_ref_1175"><a href="notational-conventions.html#mathematical-value">Mathematical values</a></emu-xref> together with +∞ and -∞.</li>
|
||
<li><em>Numbers</em>: <emu-xref href="#sec-bibliography" id="_ref_1176"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> binary64 (double-precision floating point) values.</li>
|
||
<li><em>BigInts</em>: <emu-xref href="#sec-ecmascript-language-types" id="_ref_1177"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref> representing arbitrary <emu-xref href="#integer" id="_ref_1178"><a href="notational-conventions.html#integer">integers</a></emu-xref> in a one-to-one correspondence.</li>
|
||
</ul>
|
||
|
||
<p>In the language of this specification, numerical values are distinguished among different numeric kinds using subscript suffixes. The subscript <sub>𝔽</sub> refers to Numbers, and the subscript <sub>ℤ</sub> refers to BigInts. Numeric values without a subscript suffix refer to <emu-xref href="#mathematical-value" id="_ref_1179"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref>. This specification denotes most numeric values in base 10; it also uses numeric values of the form 0x followed by digits 0-9 or A-F as base-16 values.</p>
|
||
<p>In general, when this specification refers to a numerical value, such as in the phrase, "the length of <var>y</var>" or "the <emu-xref href="#integer" id="_ref_1180"><a href="notational-conventions.html#integer">integer</a></emu-xref> represented by the four hexadecimal digits ...", without explicitly specifying a numeric kind, the phrase refers to a <emu-xref href="#mathematical-value" id="_ref_1181"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref>. Phrases which refer to a Number or a BigInt value are explicitly annotated as such; for example, "the <emu-xref href="#number-value-for" id="_ref_1182"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the number of code points in …" or "the <emu-xref href="#bigint-value-for" id="_ref_1183"><a href="notational-conventions.html#bigint-value-for">BigInt value for</a></emu-xref> …".</p>
|
||
<p>When the term <dfn id="integer" oldids="mathematical integer" variants="integers" tabindex="-1"><span id="mathematical integer"></span>integer</dfn> is used in this specification, it refers to a <emu-xref href="#mathematical-value" id="_ref_1184"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> which is in the set of <emu-xref href="#integer" id="_ref_1185"><a href="notational-conventions.html#integer">integers</a></emu-xref>, unless otherwise stated. When the term <dfn id="integral-number" oldids="sec-isintegralnumber,sec-isinteger" variants="integral Numbers" tabindex="-1"><span id="sec-isinteger"></span><span id="sec-isintegralnumber"></span>integral Number</dfn> is used in this specification, it refers to a <emu-xref href="#finite" id="_ref_1186"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> Number value whose <emu-xref href="#mathematical-value" id="_ref_1187"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> is in the set of <emu-xref href="#integer" id="_ref_1188"><a href="notational-conventions.html#integer">integers</a></emu-xref>.</p>
|
||
<p>Numeric operators such as +, ×, =, and ≥ refer to those operations as determined by the type of the operands. When applied to <emu-xref href="#mathematical-value" id="_ref_1189"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref>, the operators refer to the usual mathematical operations. When applied to <emu-xref href="#extended-mathematical-value" id="_ref_1190"><a href="notational-conventions.html#extended-mathematical-value">extended mathematical values</a></emu-xref>, the operators refer to the usual mathematical operations over the extended real numbers; indeterminate forms are not defined and their use in this specification should be considered an editorial error. When applied to Numbers, the operators refer to the relevant operations within <emu-xref href="#sec-bibliography" id="_ref_1191"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref>. When applied to BigInts, the operators refer to the usual mathematical operations applied to the <emu-xref href="#mathematical-value-of" id="_ref_1192"><a href="notational-conventions.html#mathematical-value-of">mathematical value of</a></emu-xref> the BigInt. Numeric operators applied to mixed-type operands (such as a Number and a <emu-xref href="#mathematical-value" id="_ref_1193"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref>) are not defined and should be considered an editorial error in this specification.</p>
|
||
<p>Conversions between <emu-xref href="#mathematical-value" id="_ref_1194"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref> and Numbers or BigInts are always explicit in this document. A conversion from a <emu-xref href="#mathematical-value" id="_ref_1195"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> or <emu-xref href="#extended-mathematical-value" id="_ref_1196"><a href="notational-conventions.html#extended-mathematical-value">extended mathematical value</a></emu-xref> <var>x</var> to a Number is denoted as "the <emu-xref href="#number-value-for" id="_ref_1197"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> <var>x</var>" or <emu-eqn id="𝔽" aoid="𝔽" class="inline">𝔽(<var>x</var>)</emu-eqn>, and is defined in <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_43"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">6.1.6.1</a></emu-xref>. A conversion from an <emu-xref href="#integer" id="_ref_1198"><a href="notational-conventions.html#integer">integer</a></emu-xref> <var>x</var> to a BigInt is denoted as "the <dfn id="bigint-value-for" tabindex="-1">BigInt value for</dfn> <var>x</var>" or <emu-eqn id="ℤ" aoid="ℤ" class="inline">ℤ(<var>x</var>)</emu-eqn>. A conversion from a Number or BigInt <var>x</var> to a <emu-xref href="#mathematical-value" id="_ref_1199"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> is denoted as "the <dfn id="mathematical-value-of" tabindex="-1">mathematical value of</dfn> <var>x</var>", or <emu-eqn id="ℝ" aoid="ℝ" class="inline">ℝ(<var>x</var>)</emu-eqn>. The <emu-xref href="#mathematical-value-of" id="_ref_1200"><a href="notational-conventions.html#mathematical-value-of">mathematical value of</a></emu-xref> <emu-val>+0</emu-val><sub>𝔽</sub> and <emu-val>-0</emu-val><sub>𝔽</sub> is the <emu-xref href="#mathematical-value" id="_ref_1201"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> 0. The <emu-xref href="#mathematical-value-of" id="_ref_1202"><a href="notational-conventions.html#mathematical-value-of">mathematical value of</a></emu-xref> non-<emu-xref href="#finite" id="_ref_1203"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> values is not defined. The <dfn id="extended-mathematical-value-of" tabindex="-1">extended mathematical value of</dfn> <var>x</var> is the <emu-xref href="#mathematical-value-of" id="_ref_1204"><a href="notational-conventions.html#mathematical-value-of">mathematical value of</a></emu-xref> <var>x</var> for <emu-xref href="#finite" id="_ref_1205"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> values, and is +∞ and -∞ for <emu-val>+∞</emu-val><sub>𝔽</sub> and <emu-val>-∞</emu-val><sub>𝔽</sub> respectively; it is not defined for <emu-val>NaN</emu-val>.</p>
|
||
<p>The mathematical function <emu-eqn id="eqn-abs" aoid="abs" class="inline">abs(<var>x</var>)</emu-eqn> produces the absolute value of <var>x</var>, which is <emu-eqn class="inline">-<var>x</var></emu-eqn> if <var>x</var> < 0 and otherwise is <var>x</var> itself.</p>
|
||
<p>The mathematical function <emu-eqn id="eqn-ln" aoid="ln" class="inline">ln(<var>x</var>)</emu-eqn> produces the natural logarithm of <var>x</var>. The mathematical function <emu-eqn id="eqn-log10" aoid="log10" class="inline">log10(<var>x</var>)</emu-eqn> produces the base 10 logarithm of <var>x</var>. The mathematical function <emu-eqn id="eqn-log2" aoid="log2" class="inline">log2(<var>x</var>)</emu-eqn> produces the base 2 logarithm of <var>x</var>.</p>
|
||
<p>The mathematical function <emu-eqn id="eqn-min" aoid="min" class="inline">min(<var>x1</var>, <var>x2</var>, … , <var>xN</var>)</emu-eqn> produces the mathematically smallest of <emu-eqn class="inline"><var>x1</var></emu-eqn> through <emu-eqn class="inline"><var>xN</var></emu-eqn>. The mathematical function <emu-eqn id="eqn-max" aoid="max" class="inline">max(<var>x1</var>, <var>x2</var>, ..., <var>xN</var>)</emu-eqn> produces the mathematically largest of <emu-eqn class="inline"><var>x1</var></emu-eqn> through <emu-eqn class="inline"><var>xN</var></emu-eqn>. The domain and range of these mathematical functions are the <emu-xref href="#extended-mathematical-value" id="_ref_1206"><a href="notational-conventions.html#extended-mathematical-value">extended mathematical values</a></emu-xref>.</p>
|
||
<p>The notation “<emu-eqn id="eqn-modulo" aoid="modulo" class="inline"><var>x</var> modulo <var>y</var></emu-eqn>” (<var>y</var> must be <emu-xref href="#finite" id="_ref_1207"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> and non-zero) computes a value <var>k</var> of the same sign as <var>y</var> (or zero) such that <emu-eqn class="inline"><emu-xref aoid="abs" id="_ref_1208"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<var>k</var>) < <emu-xref aoid="abs" id="_ref_1209"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<var>y</var>) and <var>x</var> - <var>k</var> = <var>q</var> × <var>y</var></emu-eqn> for some <emu-xref href="#integer" id="_ref_1210"><a href="notational-conventions.html#integer">integer</a></emu-xref> <var>q</var>.</p>
|
||
<p>The phrase "the result of <dfn id="clamping" tabindex="-1">clamping</dfn> <var>x</var> between <var>lower</var> and <var>upper</var>" (where <var>x</var> is an <emu-xref href="#extended-mathematical-value" id="_ref_1211"><a href="notational-conventions.html#extended-mathematical-value">extended mathematical value</a></emu-xref> and <var>lower</var> and <var>upper</var> are <emu-xref href="#mathematical-value" id="_ref_1212"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref> such that <var>lower</var> ≤ <var>upper</var>) produces <var>lower</var> if <var>x</var> < <var>lower</var>, produces <var>upper</var> if <var>x</var> > <var>upper</var>, and otherwise produces <var>x</var>.</p>
|
||
<p>The mathematical function <emu-eqn id="eqn-floor" aoid="floor" class="inline">floor(<var>x</var>)</emu-eqn> produces the largest <emu-xref href="#integer" id="_ref_1213"><a href="notational-conventions.html#integer">integer</a></emu-xref> (closest to +∞) that is not larger than <var>x</var>.</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p><emu-eqn class="inline"><emu-xref aoid="floor" id="_ref_1214"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<var>x</var>) = <var>x</var> - (<var>x</var> <emu-xref aoid="modulo" id="_ref_1215"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 1)</emu-eqn>.</p>
|
||
</div></emu-note>
|
||
<p>The mathematical function <emu-eqn id="eqn-truncate" aoid="truncate" class="inline">truncate(<var>x</var>)</emu-eqn> removes the fractional part of <var>x</var> by rounding towards zero, producing <emu-eqn class="inline">-<emu-xref aoid="floor" id="_ref_1216"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(-<var>x</var>)</emu-eqn> if <var>x</var> < 0 and otherwise producing <emu-eqn class="inline"><emu-xref aoid="floor" id="_ref_1217"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<var>x</var>)</emu-eqn>.</p>
|
||
<p>Mathematical functions <emu-xref aoid="min" id="_ref_1218"><a href="notational-conventions.html#eqn-min">min</a></emu-xref>, <emu-xref aoid="max" id="_ref_1219"><a href="notational-conventions.html#eqn-max">max</a></emu-xref>, <emu-xref aoid="abs" id="_ref_1220"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>, <emu-xref aoid="floor" id="_ref_1221"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>, and <emu-xref aoid="truncate" id="_ref_1222"><a href="notational-conventions.html#eqn-truncate">truncate</a></emu-xref> are not defined for Numbers and BigInts, and any usage of those methods that have non-<emu-xref href="#mathematical-value" id="_ref_1223"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> arguments would be an editorial error in this specification.</p>
|
||
<p>An <dfn id="interval" tabindex="-1">interval</dfn> from lower bound <var>a</var> to upper bound <var>b</var> is a possibly-infinite, possibly-empty set of numeric values of the same numeric type. Each bound will be described as either inclusive or exclusive, but not both. There are four kinds of intervals, as follows:</p>
|
||
<ul>
|
||
<li>An <emu-xref href="#interval" id="_ref_1224"><a href="notational-conventions.html#interval">interval</a></emu-xref> from <var>a</var> (inclusive) to <var>b</var> (inclusive), also called an <dfn id="inclusive-interval" tabindex="-1">inclusive interval</dfn> from <var>a</var> to <var>b</var>, includes all values <var>x</var> of the same numeric type such that <var>a</var> ≤ <var>x</var> ≤ <var>b</var>, and no others.</li>
|
||
<li>An <emu-xref href="#interval" id="_ref_1225"><a href="notational-conventions.html#interval">interval</a></emu-xref> from <var>a</var> (inclusive) to <var>b</var> (exclusive) includes all values <var>x</var> of the same numeric type such that <var>a</var> ≤ <var>x</var> < <var>b</var>, and no others.</li>
|
||
<li>An <emu-xref href="#interval" id="_ref_1226"><a href="notational-conventions.html#interval">interval</a></emu-xref> from <var>a</var> (exclusive) to <var>b</var> (inclusive) includes all values <var>x</var> of the same numeric type such that <var>a</var> < <var>x</var> ≤ <var>b</var>, and no others.</li>
|
||
<li>An <emu-xref href="#interval" id="_ref_1227"><a href="notational-conventions.html#interval">interval</a></emu-xref> from <var>a</var> (exclusive) to <var>b</var> (exclusive) includes all values <var>x</var> of the same numeric type such that <var>a</var> < <var>x</var> < <var>b</var>, and no others.</li>
|
||
</ul>
|
||
<p>For example, the <emu-xref href="#interval" id="_ref_1228"><a href="notational-conventions.html#interval">interval</a></emu-xref> from 1 (inclusive) to 2 (exclusive) consists of all <emu-xref href="#mathematical-value" id="_ref_1229"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref> between 1 and 2, including 1 and not including 2. For the purpose of defining intervals, <emu-val>-0</emu-val><sub>𝔽</sub> < <!-- this comment here to avoid ecmarkup complaining about comparison to 0 --> <emu-val>+0</emu-val><sub>𝔽</sub>, so, for example, an <emu-xref href="#inclusive-interval" id="_ref_1230"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> with a lower bound of <emu-val>+0</emu-val><sub>𝔽</sub> includes <emu-val>+0</emu-val><sub>𝔽</sub> but not <emu-val>-0</emu-val><sub>𝔽</sub>. <emu-val>NaN</emu-val> is never included in an <emu-xref href="#interval" id="_ref_1231"><a href="notational-conventions.html#interval">interval</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-value-notation">
|
||
<h1><span class="secnum">5.2.7</span> Value Notation</h1>
|
||
<p>In this specification, <emu-xref href="#sec-ecmascript-language-types" id="_ref_1232"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref> are displayed in <emu-val>bold</emu-val>. Examples include <emu-val>null</emu-val>, <emu-val>true</emu-val>, or <emu-val>"hello"</emu-val>. These are distinguished from <emu-xref href="#sec-source-text" id="_ref_1233"><a href="ecmascript-language-source-code.html#sec-source-text">ECMAScript source text</a></emu-xref> such as <code>Function.prototype.apply</code> or <code>let n = 42;</code>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-identity">
|
||
<h1><span class="secnum">5.2.8</span> Identity</h1>
|
||
<p>In this specification, both specification values and <emu-xref href="#sec-ecmascript-language-types" id="_ref_1234"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref> are compared for equality. When comparing for equality, values fall into one of two categories. <dfn variants="values without identity,value without identity" tabindex="-1">Values without identity</dfn> are equal to other values without identity if all of their innate characteristics are the same — characteristics such as the magnitude of an <emu-xref href="#integer" id="_ref_1235"><a href="notational-conventions.html#integer">integer</a></emu-xref> or the length of a sequence. Values without identity may be manifest without prior reference by fully describing their characteristics. In contrast, each <dfn variants="values with identity" tabindex="-1">value with identity</dfn> is unique and therefore only equal to itself. Values with identity are like values without identity but with an additional unguessable, unchangeable, universally-unique characteristic called <em>identity</em>. References to existing values with identity cannot be manifest simply by describing them, as the identity itself is indescribable; instead, references to these values must be explicitly passed from one place to another. Some values with identity are mutable and therefore can have their characteristics (except their identity) changed in-place, causing all holders of the value to observe the new characteristics. A value without identity is never equal to a value with identity.</p>
|
||
<p>From the perspective of this specification, the word “is” is used to compare two values for equality, as in “If <var>bool</var> is <emu-val>true</emu-val>, then ...”, and the word “contains” is used to search for a value inside lists using equality comparisons, as in "If <var>list</var> contains a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_1236"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> <var>r</var> such that <var>r</var>.<var class="field">[[Foo]]</var> is <emu-val>true</emu-val>, then ...". The <em>specification identity</em> of values determines the result of these comparisons and is axiomatic in this specification.</p>
|
||
<p>From the perspective of the ECMAScript language, language values are compared for equality using the <emu-xref aoid="SameValue" id="_ref_1237"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref> abstract operation and the <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1238"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref> it transitively calls. The algorithms of these comparison <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1239"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref> determine <em>language identity</em> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_1240"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>.</p>
|
||
<p>For specification values, examples of values without specification identity include, but are not limited to: <emu-xref href="#mathematical-value" id="_ref_1241"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref> and <emu-xref href="#extended-mathematical-value" id="_ref_1242"><a href="notational-conventions.html#extended-mathematical-value">extended mathematical values</a></emu-xref>; <emu-xref href="#sec-source-text" id="_ref_1243"><a href="ecmascript-language-source-code.html#sec-source-text">ECMAScript source text</a></emu-xref>, <emu-xref href="#surrogate-pair" id="_ref_1244"><a href="ecmascript-data-types-and-values.html#surrogate-pair">surrogate pairs</a></emu-xref>, <emu-xref href="#directive-prologue" id="_ref_1245"><a href="ecmascript-language-source-code.html#directive-prologue">Directive Prologues</a></emu-xref>, etc; UTF-16 code units; Unicode code points; <emu-xref href="#sec-enum-specification-type" id="_ref_1246"><a href="ecmascript-data-types-and-values.html#sec-enum-specification-type">enums</a></emu-xref>; <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1247"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref>, including <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_1248"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operations</a></emu-xref>, <emu-xref href="#host-hook" id="_ref_1249"><a href="overview.html#host-hook">host hooks</a></emu-xref>, etc; and ordered pairs. Examples of specification values with specification identity include, but are not limited to: any kind of <emu-xref href="#sec-list-and-record-specification-type" id="_ref_1250"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Records</a></emu-xref>, including <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_1251"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptors</a></emu-xref>, <emu-xref href="#sec-privateelement-specification-type" id="_ref_1252"><a href="ecmascript-data-types-and-values.html#sec-privateelement-specification-type">PrivateElements</a></emu-xref>, etc; <emu-xref href="#sec-syntactic-grammar" id="_ref_1253"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Nodes</a></emu-xref>; <emu-xref href="#sec-list-and-record-specification-type" id="_ref_1254"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Lists</a></emu-xref>; <emu-xref href="#sec-set-and-relation-specification-type" id="_ref_44"><a href="ecmascript-data-types-and-values.html#sec-set-and-relation-specification-type">Sets</a></emu-xref> and <emu-xref href="#sec-set-and-relation-specification-type" id="_ref_1255"><a href="ecmascript-data-types-and-values.html#sec-set-and-relation-specification-type">Relations</a></emu-xref>; <emu-xref href="#sec-abstract-closure" id="_ref_1256"><a href="ecmascript-data-types-and-values.html#sec-abstract-closure">Abstract Closures</a></emu-xref>; <emu-xref href="#sec-data-blocks" id="_ref_1257"><a href="ecmascript-data-types-and-values.html#sec-data-blocks">Data Blocks</a></emu-xref>; <emu-xref href="#sec-private-names" id="_ref_1258"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Names</a></emu-xref>; <emu-xref href="#sec-execution-contexts" id="_ref_1259"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution contexts</a></emu-xref> and <emu-xref href="#execution-context-stack" id="_ref_1260"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stacks</a></emu-xref>; <emu-xref href="#sec-agents" id="_ref_1261"><a href="executable-code-and-execution-contexts.html#sec-agents">agent signifiers</a></emu-xref>; and <emu-xref href="#sec-waiterlist-records" id="_ref_1262"><a href="structured-data.html#sec-waiterlist-records">WaiterList Records</a></emu-xref>.</p>
|
||
<p>Specification identity agrees with language identity for all <emu-xref href="#sec-ecmascript-language-types" id="_ref_1263"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref> except Symbol values produced by <emu-xref href="#sec-symbol.for" id="_ref_45"><a href="fundamental-objects.html#sec-symbol.for">Symbol.for</a></emu-xref>. The <emu-xref href="#sec-ecmascript-language-types" id="_ref_1264"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref> without specification identity and without language identity are <emu-xref href="#sec-ecmascript-language-types-undefined-type" id="_ref_46"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-undefined-type"><emu-val>undefined</emu-val></a></emu-xref>, <emu-xref href="#sec-ecmascript-language-types-null-type" id="_ref_47"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-null-type"><emu-val>null</emu-val></a></emu-xref>, <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_48"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">Booleans</a></emu-xref>, <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_49"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">Strings</a></emu-xref>, <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_50"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">Numbers</a></emu-xref>, and <emu-xref href="#sec-ecmascript-language-types-bigint-type" id="_ref_51"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-bigint-type">BigInts</a></emu-xref>. The <emu-xref href="#sec-ecmascript-language-types" id="_ref_1265"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref> with specification identity and language identity are <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_52"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">Symbols</a></emu-xref> not produced by <emu-xref href="#sec-symbol.for" id="_ref_53"><a href="fundamental-objects.html#sec-symbol.for">Symbol.for</a></emu-xref> and <emu-xref href="#sec-object-type" id="_ref_54"><a href="ecmascript-data-types-and-values.html#sec-object-type">Objects</a></emu-xref>. Symbol values produced by <emu-xref href="#sec-symbol.for" id="_ref_55"><a href="fundamental-objects.html#sec-symbol.for">Symbol.for</a></emu-xref> have specification identity, but not language identity.</p>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
</emu-clause></div></body></html> |