diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..2f244ac814 --- /dev/null +++ b/LICENSE @@ -0,0 +1,395 @@ +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/README.md b/README.md index 0b0205d654..494b53a890 100755 --- a/README.md +++ b/README.md @@ -95,6 +95,6 @@ Pull requests: ## 联系我们 - +![81518255655_ pic](https://user-images.githubusercontent.com/10306332/36060706-c33e4e56-0e89-11e8-9488-ad103be18a3b.jpg) 如果二维码过期,请加微信号:liu762022369 diff --git a/translated/issues-8.html b/translated/issues-8.html index 511872c4a1..2b9aa2db49 100755 --- a/translated/issues-8.html +++ b/translated/issues-8.html @@ -1,8 +1,8 @@ - -

Algorithm Conventions

-

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.

-

Algorithms may be explicitly parameterized, in which case the names and usage of the parameters must be provided as part of the algorithm's definition.

-

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 lower case alphabetic characters and the second level of substeps labelled with lower case roman numerals. If more than three levels are required these rules repeat with the fourth level using numeric labels. For example:

+ +

算法约定

+

此规范通常使用带编号的列表来指定算法的步骤。这些算法是用来精确地指定 ECMAScript 语言结构所需的语义。该算法无意暗示任何具体实现使用的技术。在实践中,也许可用更有效的算法实现一个给定功能。

+

算法可能被显式参数化,在这种情况下,参数名和用法必须作为算法定义的一部分提供。

+

算法步骤可以细分为多个连续的子步骤。子步骤需要用缩进表示,可以进一步被划分成缩进的子步骤。大纲编号约定用作标识子步骤,第一级子步骤使用小写字母字符标记,第二级小步骤用小写罗马数字标记。如果步骤超过三级,那么这些规则从第四级开始从数字重复进行标记。例如:

1. Top-level step 1. Substep. @@ -12,109 +12,109 @@

Algorithm Conventions

1. Subsubsubsubstep 1. Subsubsubsubsubstep
-

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.

-

A step may specify the iterative application of its substeps.

-

A step that begins with “Assert:” 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.

-

Algorithm steps may declare named aliases for any value using the form “Let _x_ be _someValue_”. These aliases are reference-like in that both _x_ and _someValue_ 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 _x_ be a copy of _someValue_” creates a shallow copy of _someValue_.

-

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 _x_ to _someOtherValue_”.

+

一个步骤或者子步骤也许会使用 “if” 去断言它的子步骤的条件。在这样的案例中,这些子步骤只能适用于 “if” 断言为真的情况。如果一个步骤或者子步骤以 “else” 开始,那么表示这是之前的 “if” 断言的同一级的否定断言。

+

一个步骤也许会指定它的子步骤的迭代程序。

+

一个以 “Assert:” 开头的步骤断言一个它的算法里不变的条件。这样的断言被用作使算法不变量显式地展示,否则它将是隐式的。这样的断言不增加额外的语义需求,因此实现不必检查。它们被使用只是为了使算法更清晰。

+

对于任意形如 “Let _x_ be _someValue_” 的值,算法步骤也许会声明命名别名。这些别名都是类似类型的,即 x 和 someValue 指向同样的基础数据,对它们的修改是互相可见的。那些想避免这样的类似引用的算法步骤需要显式地复制一份右值:即 “Let_x_ be a copy of _someValue_” 创建了一个 _someValue_ 的浅复制。

+

一旦声明完毕,别名可以在任何后续步骤中引用,而不能在别名声明前的步骤中使用。别名也许会通过形如 “Set _x_ to _someOtherValue_” 这样的形式被修改。

-

Abstract Operations

-

In order to facilitate their use in multiple parts of this specification, some algorithms, called abstract operations, 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(_arg1_, _arg2_). 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 _someValue_.OperationName(_arg1_, _arg2_).

+

抽象操作

+

为了便于它们在本规范的多个地方使用,一些算法,我们称之为抽象操作,以参数化函数形式命名和书写,以便它们能够在其它算法中通过名称来引用。抽象操作通常使用函数应用风格被引用,如 OperationName(_arg1_, _arg2_)。一些抽象操作被当作像类规范里抽象的多态发送一样。这样的类似类的方法抽象操作通常通过一个方法应用风格被引用,如 _someValue_.OperationName(_arg1_, _arg2_)。

-

Syntax-Directed Operations

-

A syntax-directed operation 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.

-

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.

-

Syntax-directed operations are invoked with a parse node and, optionally, other parameters by using the conventions on steps 1, 3, and 4 in the following algorithm:

+

语法导向操作

+

一个语法导向操作是一个具名操作,它的定义包含了一系列算法,每个算法与一个或者多个 ECMAScript 文法的产生式相关联。一个有多个可选定义的产生式通常对于每个可选部分都有一个独立的算法。当一个算法与一个文法产生式相关联的时候,它也许会引用这个产生式可选部分的终结符或者非终结符,就好像它们是这个算法的参数一样。当出现这种情况时,非终结符指向实际的源代码中与之匹配的可选部分的定义。

+

当一个算法与一个产生式的可选部分关联的时候,这个可选部分通常不会带上 “[ ]” 文法注释。这样的注释只应该影响可选部分的语法识别,不应该对相关的可选部分的语义有影响。

+

语法导向操作同一个解析节点一起被调用,还可以在以下算法步骤 1,3,4 中使用这个约定的其它参数:

1. Let _status_ be the result of performing SyntaxDirectedOperation of |SomeNonTerminal|. 2. Let _someParseNode_ be the parse of some source text. 2. Perform SyntaxDirectedOperation of _someParseNode_. 2. Perform SyntaxDirectedOperation of _someParseNode_ passing `"value"` as the argument. -

Unless explicitly specified otherwise, all chain productions 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 chain production's sole right-hand side nonterminal and then returns the result. For example, assume that some algorithm has a step of the form: “Return the result of evaluating |Block|” and that there is a production:

+

除非另有明确说明,否则,所有相关联的产生式对于每个也许会被应用到这个产生式左值的非终结符的操作都有一个隐式的定义。如果存在的话,这个隐式的定义简单地再次对同样的参数运用这个相同的定义,对于这些相关联的产生式唯一的右值非终结符,随后返回处理结果。例如,假设一些算法有如下形式的步骤: “Return the result of evaluating |Block|”,并且这里有一个产生式:

Block : `{` StatementList `}` -

but the Evaluation operation does not associate an algorithm with that production. In that case, the Evaluation operation implicitly includes an association of the form:

-

Runtime Semantics: Evaluation

+

但是解析操作并没有关联这个产生式的算法。那么在这样的案例中,解析操作隐式地包含了下面形式的关联:

+

运行时语义: 解析

Block : `{` StatementList `}` 1. Return the result of evaluating |StatementList|.
- + -

Runtime Semantics

-

Algorithms which specify semantics that must be called at runtime are called runtime semantics. Runtime semantics are defined by abstract operations or syntax-directed operations. Such algorithms always return a completion record.

+

运行时语义

+

必须在运行时被调用的指定语义的算法就叫运行时语义。 运行时语义通过抽象操作或者指定语法操作来定义。这样的算法必须返回一个完成记录。

-

Implicit Completion Values

-

The algorithms of this specification often implicitly return Completion Records whose [[Type]] is ~normal~. Unless it is otherwise obvious from the context, an algorithm statement that returns a value that is not a Completion Record, such as:

+

隐式完成值

+

本规范的算法常常隐式地返回一个 [[Type]] 值为 ~normal~ 的 Completion Records。除非一个返回一个值的算法语句在上下文明显指定返回一个不是 Completion Record 的值。例如:

1. Return `"Infinity"`. -

means the same thing as:

+

与下面的是同一个含义:

1. Return NormalCompletion(`"Infinity"`). -

However, if the value expression of a “return” statement is a Completion Record construction literal, the resulting Completion Record is returned. If the value expression is a call to an abstract operation, the “return” statement simply returns the Completion Record produced by the abstract operation.

-

The abstract operation Completion(_completionRecord_) is used to emphasize that a previously computed Completion Record is being returned. The Completion abstract operation takes a single argument, _completionRecord_, and performs the following steps:

+

然而,如果一个 “return” 语句的值表达式是一个 Completion Record 构造的字面量,那么 Completion Record 的结果将被返回。如果这个值表达式是一个对抽象操作的调用,那么 “return” 语句简单地返回这个抽象操作产生的 Completion Record。

+

抽象操作 Completion(_completionRecord_) 被用作强调之前计算的 Completion Record 被返回。Completion 这个抽象操作接收一个参数,即 _completionRecord_,然后执行下面的步骤:

1. Assert: _completionRecord_ is a Completion Record. 1. Return _completionRecord_ as the Completion Record of this abstract operation. -

A “return” statement without a value in an algorithm step means the same thing as:

+

一个在算法步骤中没有值的 “return” 语句与下面的是同样的意思:

- 1. Return NormalCompletion(*undefined*). + 1. Return NormalCompletion(`undefined`). -

Any reference to a Completion Record value that is in a context that does not explicitly require a complete Completion Record value is equivalent to an explicit reference to the [[Value]] field of the Completion Record value unless the Completion Record is an abrupt completion.

+

对于任意的在一个上下文中没有显示地需要一个完整的 Completion Record 值的引用,等价于一个显式地对 Completion Record 的 [[Value]] 字段的引用,除非 Completion Record 是一个中断完成

- + -

Throw an Exception

-

Algorithms steps that say to throw an exception, such as

+

抛出一个异常

+

描述抛出一个异常的算法步骤,例如:

1. Throw a *TypeError* exception. -

mean the same things as:

+

与下面的是同一个含义:

- 1. Return Completion{[[Type]]: ~throw~, [[Value]]: a newly created *TypeError* object, [[Target]]: ~empty~}. + 1. Return Completion{[[Type]]: throw, [[Value]]: a newly created `TypeError` object, [[Target]]: empty}.
- + -

ReturnIfAbrupt

-

Algorithms steps that say or are otherwise equivalent to:

+

ReturnIfAbrupt

+

算法步骤说明或者等同于:

1. ReturnIfAbrupt(_argument_). -

mean the same thing as:

+

意思就是:

1. If _argument_ is an abrupt completion, return _argument_. 1. Else if _argument_ is a Completion Record, let _argument_ be _argument_.[[Value]]. -

Algorithms steps that say or are otherwise equivalent to:

+

算法步骤说明或者等同于:

1. ReturnIfAbrupt(AbstractOperation()). -

mean the same thing as:

+

与下面的是同一个含义:

1. Let _hygienicTemp_ be AbstractOperation(). 1. If _hygienicTemp_ is an abrupt completion, return _hygienicTemp_. 1. Else if _hygienicTemp_ is a Completion Record, let _hygienicTemp_ be _hygienicTemp_.[[Value]]. -

Where _hygienicTemp_ is ephemeral and visible only in the steps pertaining to ReturnIfAbrupt.

-

Algorithms steps that say or are otherwise equivalent to:

+

这里的 _hygienicTemp_ 是临时的,并且只在 ReturnIfAbrupt 有关的步骤中中可见。

+

算法步骤说明或者等同于:

1. Let _result_ be AbstractOperation(ReturnIfAbrupt(_argument_)). -

mean the same thing as:

+

与下面的是同一个含义:

1. If _argument_ is an abrupt completion, return _argument_. 1. If _argument_ is a Completion Record, let _argument_ be _argument_.[[Value]]. @@ -122,34 +122,34 @@

ReturnIfAbrupt

-

ReturnIfAbrupt Shorthands

-

Invocations of abstract operations and syntax-directed operations that are prefixed by `?` indicate that ReturnIfAbrupt should be applied to the resulting Completion Record. For example, the step:

+

ReturnIfAbrupt 缩写

+

对抽象操作和以 `?` 为前缀的指定语法操作的调用暗示着 ReturnIfAbrupt 需要被应用到结果的 Completion Record 中。 例如,步骤:

1. ? OperationName(). -

is equivalent to the following step:

+

等价于下面的步骤:

1. ReturnIfAbrupt(OperationName()). -

Similarly, for method application style, the step:

+

相似的,对于程序方法的风格,步骤:

1. ? _someValue_.OperationName(). -

is equivalent to:

+

等价于:

1. ReturnIfAbrupt(_someValue_.OperationName()). -

Similarly, prefix `!` is used to indicate that the following invocation of an abstract or syntax-directed operation will never return an abrupt completion and that the resulting Completion Record's [[Value]] field should be used in place of the return value of the operation. For example, the step:

+

相似的,前缀 `!` 被用作暗示下列的对于抽象或者指定语法操作的调用将不会返回一个打断的完成值, 并且作为结果的 Completion Record 的 [[Value]] 字段应该被用作替换操作的返回值。 例如,步骤:

1. Let _val_ be ! OperationName(). -

is equivalent to the following steps:

+

等价于下面的步骤:

1. Let _val_ be OperationName(). 1. Assert: _val_ is never an abrupt completion. 1. If _val_ is a Completion Record, set _val_ to _val_.[[Value]]. -

Syntax-directed operations for runtime semantics make use of this shorthand by placing `!` or `?` before the invocation of the operation:

+

对于运行时语义的指定语法的操作通过在调用操作前替换 `!` 或者 `?` 来利用这个缩写。

1. Perform ! SyntaxDirectedOperation of |NonTerminal|. @@ -157,10 +157,10 @@

ReturnIfAbrupt Shorthands

-

Static Semantics

-

Context-free grammars are not sufficiently powerful to express all the rules that define whether a stream of input elements form a valid ECMAScript |Script| or |Module| 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 static semantics of the production.

-

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.

-

Unless otherwise specified every grammar production alternative in this specification implicitly has a definition for a static semantic rule named Contains which takes an argument named _symbol_ whose value is a terminal or nonterminal of the grammar that includes the associated production. The default definition of Contains is:

+

静态语义

+

上下文无关文法不能足够好的去表达所有定义的规则,不管是一个输入元素的流形成的一个合法的将被解析的 ECMAScript |Script| 还是 |Module|。在一些情况中,需要额外的规则通过使用 ECMAScript 算法约定或者散文要求来展示。这样的规则总是与一个文法的产生式相关联,被称作产生式的静态语义

+

静态语义规则拥有名称,并且通常用一个算法来定义。具有名称的静态语义规则与文法产生式相关联,对于每个可采用的具有名称的静态语义规则, 一个包含多个可选部分定义的产生式通常会对每个可选部分定义一个独有的算法。

+

除非在本规范中其它指定的文法产生式可选部分隐式地包含一个叫做 Contains 的接收一个值为包含相关产生式的文法的终结符或者非终结符的 _symbol_ 参数静态语义规则的定义。 默认的包含定义为:

1. For each child node _child_ of this Parse Node, do 1. If _child_ is an instance of _symbol_, return *true*. @@ -169,16 +169,16 @@

Static Semantics

1. If _contained_ is *true*, return *true*. 1. Return *false*.
-

The above definition is explicitly over-ridden for specific productions.

-

A special kind of static semantic rule is an Early Error Rule. Early error rules define early error conditions (see clause ) that are associated with specific grammar productions. Evaluation of most early error rules are not explicitly invoked within the algorithms of this specification. A conforming implementation must, prior to the first evaluation of a |Script| or |Module|, validate all of the early error rules of the productions used to parse that |Script| or |Module|. If any of the early error rules are violated the |Script| or |Module| is invalid and cannot be evaluated.

+

上面的定义是显式地重写了规范的产生式。

+

一个特殊的静态语义规则是早期(提前)错误规则。早期错误规则定了早期错误条件(见 ),它们与具体的文法产生式相关联。大多数早期错误规则的解析不是在本规范的算法中显式地被调用。一个符合规范的实现必须在第一次解析 |Script| 或者 |Module| 之前,验证所有被用作解析 |Script| 或者 |Module| 的产生式的早期错误规则。如果违反了任意的早期错误规则,那么 |Script| 或者 |Module| 就是不合法的,并且不能被解析执行。

-

Mathematical Operations

-

Mathematical operations such as addition, subtraction, negation, multiplication, division, and the mathematical functions defined later in this clause should always be understood as computing exact mathematical results on mathematical real numbers, which unless otherwise noted do not include infinities and do not include a negative zero that is distinguished from positive zero. Algorithms in this standard that model floating-point arithmetic include explicit steps, where necessary, to handle infinities and signed zero and to perform rounding. If a mathematical operation or function is applied to a floating-point number, it should be understood as being applied to the exact mathematical value represented by that floating-point number; such a floating-point number must be finite, and if it is *+0* or *-0* then the corresponding mathematical value is simply 0.

-

The mathematical function abs(_x_) produces the absolute value of _x_, which is -_x_ if _x_ is negative (less than zero) and otherwise is _x_ itself.

-

The mathematical function min(_x1_, _x2_, ..., _xN_) produces the mathematically smallest of _x1_ through _xN_. The mathematical function max(_x1_, _x2_, ..., _xN_) produces the mathematically largest of _x1_ through _xN_. The domain and range of these mathematical functions include *+∞* and *-∞*.

-

The notation “_x_ modulo _y_” (_y_ must be finite and nonzero) computes a value _k_ of the same sign as _y_ (or zero) such that abs(_k_) < abs(_y_) and _x_-_k_ = _q_ × _y_ for some integer _q_.

-

The mathematical function floor(_x_) produces the largest integer (closest to positive infinity) that is not larger than _x_.

+

数学操作

+

除非其它地方特别注明不包括无限并且不包括负 0(为了与正 0 区分),数学操作,例如加,减,否定(逻辑非),乘,除以及随后在条款中定义的数学函数应总是被当作是对于数学中所有真实数字计算出来的准确的结果。本规范算法中的浮点运算包含显式地的步骤,它们对于处理无穷,有符号的0,以及舍入是必要的。如果一个数学操作或者函数被应用在一个浮点数上,那么它必须被当作应用到用浮点数表示的具体的数学值;这样的浮点数必须是有限的,并且如果它是 *+0* 或者 *-0* 的话,那么相应的数学值就是简简单单的 0。

+

数学函数 abs(_x_) 用来计算 _x_ 的绝对值,如果 _x_ 是负数,那么结果就是 -_x_,否则结果就是 _x_ 本身。

+

数学函数 min(_x1_, _x2_, ..., _xN_) 计算从 _x1__xN_ 的最小值。 数学函数 max(_x1_, _x2_, ..., _xN_) 计算从 _x1__xN_ 的最大值。 这些数学函数的域以及范围包括 *+∞* 和 *-∞*。

+

符号 “_x_ modulo _y_” ( _y_ 必须是有限的且是非 0 的)计算出一个值 _k_, 它的符号与 _y_ 一致(或者是 0),这样的 _k_ 满足 abs(k) < abs(y),以及能找到某个整数y,使得 _x_-_k_ = _q_ * _y_。

+

数学函数 floor(_x_) 产生一个不大于 _x_ 的最大整数(最接近正无穷)。

floor(_x_) = _x_-(_x_ modulo 1).