From 66e818950968aa92345786751482373ee571fc8b Mon Sep 17 00:00:00 2001 From: JD Liu Date: Wed, 20 Dec 2017 00:48:34 +0800 Subject: [PATCH] translated: LN 111 - 901 issues #4, #5, #6, #7, #8 --- translated/issues-4.html | 18 ++-- translated/issues-5.html | 44 ++++----- translated/issues-6.html | 190 +++++++++++++++++++-------------------- translated/issues-7.html | 154 +++++++++++++++---------------- translated/issues-8.html | 130 +++++++++++++-------------- 5 files changed, 268 insertions(+), 268 deletions(-) diff --git a/translated/issues-4.html b/translated/issues-4.html index 11b190f0b1..c9ec37b586 100644 --- a/translated/issues-4.html +++ b/translated/issues-4.html @@ -1,12 +1,12 @@ -

Overview

-

This section contains a non-normative overview of the ECMAScript language.

-

ECMAScript is an object-oriented programming language for performing computations and manipulating computational objects within a host environment. ECMAScript as defined here is not intended to be computationally self-sufficient; indeed, there are no provisions in this specification for input of external data or output of computed results. Instead, it is expected that the computational environment of an ECMAScript program will provide not only the objects and other facilities described in this specification but also certain environment-specific objects, whose description and behaviour are beyond the scope of this specification except to indicate that they may provide certain properties that can be accessed and certain functions that can be called from an ECMAScript program.

-

ECMAScript was originally designed to be used as a scripting language, but has become widely used as a general-purpose programming language. A scripting language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. In such systems, useful functionality is already available through a user interface, and the scripting language is a mechanism for exposing that functionality to program control. In this way, the existing system is said to provide a host environment of objects and facilities, which completes the capabilities of the scripting language. A scripting language is intended for use by both professional and non-professional programmers.

-

ECMAScript was originally designed to be a Web scripting language, providing a mechanism to enliven Web pages in browsers and to perform server computation as part of a Web-based client-server architecture. ECMAScript is now used to provide core scripting capabilities for a variety of host environments. Therefore the core language is specified in this document apart from any particular host environment.

-

ECMAScript usage has moved beyond simple scripting and it is now used for the full spectrum of programming tasks in many different environments and scales. As the usage of ECMAScript has expanded, so has the features and facilities it provides. ECMAScript is now a fully featured general-purpose programming language.

-

Some of the facilities of ECMAScript are similar to those used in other programming languages; in particular C, Java™, Self, and Scheme as described in:

+

概述

+

本节包含对 ECMAScript 语言非规范性的概述。

+

ECMAScript是一门在宿主环境执行计算以及操作可计算对象的面向对象编程语言。这里定义的ECMAScript并不打算有自给自足的计算;事实上,该规范并没有规定外部数据的输入或者计算结果的输出。相反,我们期望ECMAScript程序的计算环境不仅提供本规范中描述的对象和能力,还能特定环境对象,本规范除了说明这些对象应该提供可被ECMAScript程序访问的某些属性,调用的某些方法外,关于它的其他描述和行为不在本规范涉及的范围。

+

ECMAScript最初被设计为一门脚本语言,但是现在已经作为一门通用的编程语言被广泛应用。脚本语言是指一种用于操作,定制,自动化现有系统能力的编程语言。在这样的系统中,通过用户接口使的有用的功能变得可用,而脚本语言就是暴露这些功能给程序控制的机制。以这样的方式,来完成脚本语言能力的系统被称作提供对象和功能的宿主环境。脚本语言的目的是专业和非专业的程序员都可以使用。

+

ECMAScript最初被设计为 Web 脚本语言,提供了一种让网页更加富有生机的机制,并能够进行部分基于Web B/S架构的服务器端计算。ECMAScript现在用于多种宿主中提供核心脚本能力。因此该文档描述的是除特定宿主环境外的语言核心。

+

ECMAScript用法已经远超出了简单脚本,现在被用于很多不同的环境和规模的全方位编程任务。随着ECMAScript不断扩大使用范围,其功能和设施也得到了扩展。ECMAScript现在成为了一个功能齐全的通用编程语言。

+

ECMAScript的一些能力类似于其他编程语言中,特别是C, Java™, Self, 以及Scheme,如下所述:

ISO/IEC 9899:1996, Programming Languages – C.

-

Gosling, James, Bill Joy and Guy Steele. The Java Language Specification. Addison Wesley Publishing Co., 1996.

-

Ungar, David, and Smith, Randall B. Self: The Power of Simplicity. OOPSLA '87 Conference Proceedings, pp. 227-241, Orlando, FL, October 1987.

+

Gosling, James, Bill Joy and Guy Steele. The Java Language Specification. Addison Wesley PublishingCo., 1996.

+

Ungar, David, and Smith, Randall B. Self: The Power of Simplicity. OOPSLA '87 Conference Proceedings, pp. 227-241,Orlando, FL, October 1987.

IEEE Standard for the Scheme Programming Language. IEEE Std 1178-1990.

\ No newline at end of file diff --git a/translated/issues-5.html b/translated/issues-5.html index 1d38a58d0b..a605a6979e 100644 --- a/translated/issues-5.html +++ b/translated/issues-5.html @@ -1,40 +1,40 @@ -

Web Scripting

-

A web browser provides an ECMAScript host environment for client-side computation including, for instance, objects that represent windows, menus, pop-ups, dialog boxes, text areas, anchors, frames, history, cookies, and input/output. Further, the host environment provides a means to attach scripting code to events such as change of focus, page and image loading, unloading, error and abort, selection, form submission, and mouse actions. Scripting code appears within the HTML and the displayed page is a combination of user interface elements and fixed and computed text and images. The scripting code is reactive to user interaction, and there is no need for a main program.

-

A web server provides a different host environment for server-side computation including objects representing requests, clients, and files; and mechanisms to lock and share data. By using browser-side and server-side scripting together, it is possible to distribute computation between the client and server while providing a customized user interface for a Web-based application.

-

Each Web browser and server that supports ECMAScript supplies its own host environment, completing the ECMAScript execution environment.

+

Web 脚本

+

web浏览器提供了客户端计算的ECMAScript宿主环境,如代表windows, menus, pop-ups, dialog boxes, text areas, anchors, frames, history, cookies以及输入输出的实例对象,进一步的,宿主环境提供了脚本代码处理如改变焦点、页面和图片的加载、卸载、错误和中断,选择,表单提交和鼠标交互等等事件的能力。通过HTML中的脚本代码组合用户接口元素,固定及计算文本,图片来显示页面。脚本代码可对用户交互进行响应并且不需要一个主程序。

+

WEB服务器提供一个不同于客户端的如代表请求,客户端,文件等的对象,数据锁定和分享的机制等的服务端计算宿主环境。通过浏览器端脚本及服务端脚本的配合使用,使得基于Web的应用程序通过提供特定的接口在客户端和服务端之间进行分布式计算成为可能。

+

每一种支持ECMAScript的WEB浏览器和服务器都将它们自身的宿主环境作为ECMAScript的补充,以使得ECMAScript的执行环境变得完整。

-

ECMAScript Overview

-

The following is an informal overview of ECMAScript—not all parts of the language are described. This overview is not part of the standard proper.

-

ECMAScript is object-based: basic language and host facilities are provided by objects, and an ECMAScript program is a cluster of communicating objects. In ECMAScript, an object is a collection of zero or more properties each with attributes that determine how each property can be used—for example, when the Writable attribute for a property is set to *false*, any attempt by executed ECMAScript code to assign a different value to the property fails. Properties are containers that hold other objects, primitive values, or functions. A primitive value is a member of one of the following built-in types: Undefined, Null, Boolean, Number, String, and Symbol; an object is a member of the built-in type Object; and a function is a callable object. A function that is associated with an object via a property is called a method.

-

ECMAScript defines a collection of built-in objects that round out the definition of ECMAScript entities. These built-in objects include the global object; objects that are fundamental to the runtime semantics of the language including `Object`, `Function`, `Boolean`, `Symbol`, and various `Error` objects; objects that represent and manipulate numeric values including `Math`, `Number`, and `Date`; the text processing objects `String` and `RegExp`; objects that are indexed collections of values including `Array` and nine different kinds of Typed Arrays whose elements all have a specific numeric data representation; keyed collections including `Map` and `Set` objects; objects supporting structured data including the `JSON` object, `ArrayBuffer`, `SharedArrayBuffer`, and `DataView`; objects supporting control abstractions including generator functions and `Promise` objects; and reflection objects including `Proxy` and `Reflect`.

-

ECMAScript also defines a set of built-in operators. ECMAScript operators include various unary operations, multiplicative operators, additive operators, bitwise shift operators, relational operators, equality operators, binary bitwise operators, binary logical operators, assignment operators, and the comma operator.

-

Large ECMAScript programs are supported by modules which allow a program to be divided into multiple sequences of statements and declarations. Each module explicitly identifies declarations it uses that need to be provided by other modules and which of its declarations are available for use by other modules.

-

ECMAScript syntax intentionally resembles Java syntax. ECMAScript syntax is relaxed to enable it to serve as an easy-to-use scripting language. For example, a variable is not required to have its type declared nor are types associated with properties, and defined functions are not required to have their declarations appear textually before calls to them.

+

ECMAScript 概述

+

以下是ECMAScript—的非正式概述 —— 描述的只是该语言的一部分。这个概述不是标准的一部分。

+

ECMAScript是基于对象的:基础语言以及主要能力都是通过对象提供,一个ECMAScript程序是一组可通信对象。在ECMAScript中,一个object是零个或多个属性(properties)的的集合。每个属性都有确定其如何被使用的特性attributes, 如当一个属性的Writable特新设置为`false`时,执行任何尝试对该属性分配不同值的的ECMAScript代码都将失败。属性是其他对象,原始值函数的容器。原始值是以下内置类型成员之一:Undefined, Null, Boolean, Number, String, and Symbol;一个对象是内置类型Object成员之一,一个函数是一个可调用对象。对象通过属性调用的函数叫做方法

+

ECMAScript定义了一组内置对象(built-in objects),从而勾勒出ECMAScript实体的定义。这些内置对象包括全局对象;基本的语言运行时语义对象,包括`Object`, `Function`, `Boolean`, `Symbol`;各种`Error`对象;代表和操作的数值对象`Math`,`Number`, `Date`;文本处理对象`String`,`RegExp`;值集合的索引对象`Array`以及九种值具有特定数字数据表示的`Typed Array`;泛型对象`Map`, `Set`;支持结构化数据的`JSON`, `ArrayBuffer`, `SharedArrayBuffer`,`DataView`等对象;支持控制抽象的generator函数,`Promise`;以及反射对象Proxy,Reflect。

+

ECMAScript还定义了一组内置运算符。ECMAScript运算符包括各种一元运算,乘法运算符,加法运算符,位移运算符,关系运算符, 等式运算符,二进制运算符,二进制逻辑运算符,赋值运算符和逗号运算符。

+

大型ECMAScript程序通过模块被支持,其允许程序可以被分化为多个语句和定义序列。每个模块明确地标识它所使用的其他模块提供的声明,哪些声明可供其他模块使用。

+

ECMAScript语法有意地类似于Java语法。ECMAScript语法是松散的,使其成为易于使用的脚本语言。例如,一个变量不需要声明其类型,属性也不需要与类型相关联,在调用定义的函数之前不需要以文本方式显示的声明。

Objects

-

Even though ECMAScript includes syntax for class definitions, ECMAScript objects are not fundamentally class-based such as those in C++, Smalltalk, or Java. Instead objects may be created in various ways including via a literal notation or via constructors which create objects and then execute code that initializes all or part of them by assigning initial values to their properties. Each constructor is a function that has a property named `"prototype"` that is used to implement prototype-based inheritance and shared properties. Objects are created by using constructors in new expressions; for example, `new Date(2009,11)` creates a new Date object. Invoking a constructor without using new has consequences that depend on the constructor. For example, `Date()` produces a string representation of the current date and time rather than an object.

-

Every object created by a constructor has an implicit reference (called the object's prototype) to the value of its constructor's `"prototype"` property. Furthermore, a prototype may have a non-null implicit reference to its prototype, and so on; this is called the prototype chain. When a reference is made to a property in an object, that reference is to the property of that name in the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if that object contains the named property, that is the property to which the reference refers; if that object does not contain the named property, the prototype for that object is examined next; and so on.

+

尽管ECMAScript包含了定义类的语法,但是ECMAScript对象从根本上来说并不是像C++,Smalltalk,Java那样基于类的。相反,对象可以通过各种方式创建,包括字面符号, 或通过构造器(constructors)创建对象然后运行代码初始化其全部或部分属性值,为这些属性分配初始值。每个构造器是一个拥有名为`"prototype"`的属性的函数,此属性用于实现基于原型的继承共享属性。构造器通过new表达式创建对象:例如,`new Date(2009,11)`创建一个新Date对象。不使用new调用一个构造器的结果由构造器本身决定。例如,`Date()`产生一个表示当前日期时间的字符串,而不是一个对象。

+

每个由构造器创建的对象,都有一个隐式引用(叫做对象的原型)链接到构造器的`"prototype"`属性值。再者,一个原型可能有一个非空隐式引用链接到它的原型,以此类推,这叫做原型链。当向对象的一个属性提出引用时,引用会指向原型链中包含此属性名的第一个对象的属性。换句话说,首先检查直接提及的对象的同名属性,如果对象包含同名的属性,引用即指向此属性,如果该对象不包含同名的属性,则下一步检查对象的原型;以此类推。

An image of lots of boxes and arrows. -

In a class-based object-oriented language, in general, state is carried by instances, methods are carried by classes, and inheritance is only of structure and behaviour. In ECMAScript, the state and methods are carried by objects, while structure, behaviour, and state are all inherited.

-

All objects that do not directly contain a particular property that their prototype contains share that property and its value. Figure 1 illustrates this:

-

CF is a constructor (and also an object). Five objects have been created by using `new` expressions: cf1, cf2, cf3, cf4, and cf5. Each of these objects contains properties named `q1` and `q2`. The dashed lines represent the implicit prototype relationship; so, for example, cf3's prototype is CFp. The constructor, CF, has two properties itself, named `P1` and `P2`, which are not visible to CFp, cf1, cf2, cf3, cf4, or cf5. The property named `CFP1` in CFp is shared by cf1, cf2, cf3, cf4, and cf5 (but not by CF), as are any properties found in CFp's implicit prototype chain that are not named `q1`, `q2`, or `CFP1`. Notice that there is no implicit prototype link between CF and CFp.

-

Unlike most class-based object languages, properties can be added to objects dynamically by assigning values to them. That is, constructors are not required to name or assign values to all or any of the constructed object's properties. In the above diagram, one could add a new shared property for cf1, cf2, cf3, cf4, and cf5 by assigning a new value to the property in CFp.

-

Although ECMAScript objects are not inherently class-based, it is often convenient to define class-like abstractions based upon a common pattern of constructor functions, prototype objects, and methods. The ECMAScript built-in objects themselves follow such a class-like pattern. Beginning with ECMAScript 2015, the ECMAScript language includes syntactic class definitions that permit programmers to concisely define objects that conform to the same class-like abstraction pattern used by the built-in objects.

+

一般情况下基于类的面向对象语言的实例拥有状态,类拥有方法,并且只能继承结构和行为。在ECMAScript中,对象拥有状态和方法,并且结构,行为,状态全都可继承。

+

所有不直接包含特定属性的对象会共享他们原型中包含的此属性及属性值。图 1 说明了这一点:

+

CF是一个构造器(也是一个对象)。五个对象已用`new`表达式创建:cf1, cf2, cf3, cf4, cf5。每个对象都有名为`q1`和`q2`的属性。 虚线表示隐式原型关系;例如:cf3的原型是 CFp。 构造器CF自己有名为`P1`和`P2`的两个属性, 这对CFp,cf1, cf2, cf3, cf4, cf5是不可见的。CFp的名为`CFP1`的属性共享给cf1, cf2,cf3, cf4, and cf5 ( 没有CF), 以及在CFp的隐式原型链中找不到任何名为`q1`,`q2`,或`CFP1`的属性。 请注意,CFCFp之间没有隐式原型链接。

+

不同于基于类的对象语言,属性可以通过赋值的方式动态添加给对象。也就是说,构造器并不是非要对构造的对象的全部或任何属性命名或赋值。上图中,可以给CFp添加新属性值的方式为cf1, cf2, cf3, cf4,and cf5添加一个新的共享属性。

+

尽管ECMAScript对象本质上不是基于类,但是基于构造函数,原型对象和方法通用模式来实现类似于类的抽象是很方便的。ECMAScript内置对象本身即遵循这样的类模式。从ECMAScript 2015开始,ECMAScript语言包含了类定义语法,允许程序员像内置对象那样简洁的定义对象。

-

The Strict Variant of ECMAScript

-

The ECMAScript Language recognizes the possibility that some users of the language may wish to restrict their usage of some features available in the language. They might do so in the interests of security, to avoid what they consider to be error-prone features, to get enhanced error checking, or for other reasons of their choosing. In support of this possibility, ECMAScript defines a strict variant of the language. The strict variant of the language excludes some specific syntactic and semantic features of the regular ECMAScript language and modifies the detailed semantics of some features. The strict variant also specifies additional error conditions that must be reported by throwing error exceptions in situations that are not specified as errors by the non-strict form of the language.

-

The strict variant of ECMAScript is commonly referred to as the strict mode of the language. Strict mode selection and use of the strict mode syntax and semantics of ECMAScript is explicitly made at the level of individual ECMAScript source text units. Because strict mode is selected at the level of a syntactic source text unit, strict mode only imposes restrictions that have local effect within such a source text unit. Strict mode does not restrict or modify any aspect of the ECMAScript semantics that must operate consistently across multiple source text units. A complete ECMAScript program may be composed of both strict mode and non-strict mode ECMAScript source text units. In this case, strict mode only applies when actually executing code that is defined within a strict mode source text unit.

-

In order to conform to this specification, an ECMAScript implementation must implement both the full unrestricted ECMAScript language and the strict variant of the ECMAScript language as defined by this specification. In addition, an implementation must support the combination of unrestricted and strict mode source text units into a single composite program.

+

ECMAScript严格变体

+

ECMAScript语言认可有些用户希望限制使用语言中某些功能的可能性。他们这样做可能是为了安全考虑,避免他们认为是容易出错的功能,获得增强的错误检查,或其他原因。为了支持这种可能性,ECMAScript中定义了语言的严格变体。语言的严格变体,排除了ECMAScript语言的某些特定的语法和语义特征,还修改了某些功能的详细语义。严格变体还指定了必须抛出错误异常报告的额外错误条件,即使在非严格的语言形式下这些条件不属于错误。

+

ECMAScript的严格变体通常被称为语言的严格模式。严格模式选择和使用明确地适用于独特ECMAScript代码单元级别的,ECMAScript严格模式语法和语义。由于语法代码单元级别的严格模式被选择,严格模式仅在这个代码单元内施加有局部效果的限制。严格模式不限制或修改任何层面的ECMAScript语义,必须一致地操作跨多个代码单元。一个ECMAScript程序可同时包含严格模式和非严格模式的代码单元。在这种情况下,严格的模式只适用于严格模式代码单元内实际执行的代码。

+

要符合这一规范,ECMAScript的实现必须同时实现未限制的ECMAScript语言和按照这个规范定义的ECMAScript的严格模式变体。此外,实现还必须支持未限制的和严格模式代码单元的在同一个程序中混用。

\ No newline at end of file diff --git a/translated/issues-6.html b/translated/issues-6.html index b8581ac8f5..e7f90cb098 100644 --- a/translated/issues-6.html +++ b/translated/issues-6.html @@ -1,276 +1,276 @@ -

Terms and Definitions

-

For the purposes of this document, the following terms and definitions apply.

+

术语与定义

+

本文档将使用下列术语和定义。

-

type

-

set of data values as defined in clause of this specification

+

类型(type)

+

在在本规范中定义的数据值集合。

-

primitive value

-

member of one of the types Undefined, Null, Boolean, Number, Symbol, or String as defined in clause

+

原始值(primitive value)

+

指在中定义的Undefined, Null, Boolean, Number, Symbol, String类型的成员

-

A primitive value is a datum that is represented directly at the lowest level of the language implementation.

+

一个原始值直接代表语言实现的最低层次的数据

object

-

member of the type Object

+

Object类型的成员

-

An object is a collection of properties and has a single prototype object. The prototype may be the null value.

+

对象是属性的集合,并且具有单个原型对象。原型可能是空值

-

constructor

-

function object that creates and initializes objects

+

构造函数(constructor)

+

创建和初始化对象的函数对象

-

The value of a constructor's `prototype` property is a prototype object that is used to implement inheritance and shared properties.

+

构造器的`prototype`属性值是用来实现继承和共享的一个原型对象。

-

prototype

-

object that provides shared properties for other objects

+

原型(prototype)

+

为其他对象提供共享属性的对象

-

When a constructor creates an object, that object implicitly references the constructor's `prototype` property for the purpose of resolving property references. The constructor's `prototype` property can be referenced by the program expression constructor.prototype, and properties added to an object's prototype are shared, through inheritance, by all objects sharing the prototype. Alternatively, a new object may be created with an explicitly specified prototype by using the `Object.create` built-in function.

+

当构造器创建一个对象,为了解决对象的属性引用,该对象会隐式引用构造器的`prototype`属性。通过程序表达式_constructor_.prototype可以引用到构造器的“prototype”属性,并且添加到对象原型里的属性,会通过继承与所有共享此原型的对象共享。另外,可使用`Object.create`内置函数,通过明确指定原型来创建一个新对象。

-

ordinary object

-

object that has the default behaviour for the essential internal methods that must be supported by all objects

+

普通对象(ordinary object)

+

默认行为拥有如那些所有对象都必须支持的内部方法作的对象

-

exotic object

-

object that does not have the default behaviour for one or more of the essential internal methods

+

异常对象(exotic object)

+

默认行为缺少一个或多个必要内部方法的对象

-

Any object that is not an ordinary object is an exotic object.

+

任何对象不是普通对象就是异常对象。

-

standard object

-

object whose semantics are defined by this specification

+

标准对象(standard object)

+

其语义由本规范定义的对象

-

built-in object

-

object specified and supplied by an ECMAScript implementation

+

内置对象(built-in object)

+

ECMAScript实现指定和提供的对象

-

Standard built-in objects are defined in this specification. An ECMAScript implementation may specify and supply additional kinds of built-in objects. A built-in constructor is a built-in object that is also a constructor.

+

标准的内置对象由本规范定义,ECMAScript实现可以指定和定义其他的一个内置构造器是个内置对象,也是个构造器。

-

undefined value

-

primitive value used when a variable has not been assigned a value

+

未定义值(undefined value)

+

一个在变量没有被赋值时就被使用的原始值

-

Undefined type

-

type whose sole value is the *undefined* value

+

Undefined类型(Undefined type)

+

值只有`undefined`的类型

-

null value

-

primitive value that represents the intentional absence of any object value

+

空值(null value)

+

表示故意缺省任何对象值的原始值

-

Null type

-

type whose sole value is the *null* value

+

Null类型(Null type)

+

值只有`null`的类型

-

Boolean value

-

member of the Boolean type

+

Boolean值(Boolean value)

+

Boolean类型的成员

-

There are only two Boolean values, *true* and *false*.

+

只有两个值, `true`和`false`.

-

Boolean type

-

type consisting of the primitive values *true* and *false*

+

Boolean类型(Boolean type)

+

由原始值`true`和`false`组成的类型

-

Boolean object

-

member of the Object type that is an instance of the standard built-in `Boolean` constructor

+

Boolean对象(Boolean object)

+

标准内置构造函数`Boolean`的实例,Object类型成员之一

-

A Boolean object is created by using the `Boolean` constructor in a `new` expression, supplying a Boolean value as an argument. The resulting object has an internal slot whose value is the Boolean value. A Boolean object can be coerced to a Boolean value.

+

通过使用`new`表达式,以一个Boolean值作为参数调用`Boolean`构造器来创建Boolean对象。由此产生的对象包含一个值为此Boolean值的内部属性。一个Boolean对象可以强制转换为Boolean值。

-

String value

-

primitive value that is a finite ordered sequence of zero or more 16-bit unsigned integer values

+

String值(String value)

+

由零个或多个16位无符号整数组成的有限有序序列原始值

-

A String value is a member of the String type. Each integer value in the sequence usually represents a single 16-bit unit of UTF-16 text. However, ECMAScript does not place any restrictions or requirements on the values except that they must be 16-bit unsigned integers.

+

一个String值是String类型的成员。通常序列中的每个整数值代表UTF-16文本的单个16位单元。然而,对于其值,ECMAScript只要求必须是16位无符号整数,除此之外没有任何限制或要求。

-

String type

-

set of all possible String values

+

String类型(String type)

+

所有可能的String值的集合

-

String object

-

member of the Object type that is an instance of the standard built-in `String` constructor

+

String对象(String object)

+

标准内置构造器`String`实例,Object类型成员之一

-

A String object is created by using the `String` constructor in a `new` expression, supplying a String value as an argument. The resulting object has an internal slot whose value is the String value. A String object can be coerced to a String value by calling the `String` constructor as a function ().

+

通过使用`new`表达式,以一个String值为参数调用`String`构造器来创建String对象。由此产生的对象包含一个值为此String值的内部属性。将`String`构造器作为一个函数来调用,可将一个String对象强制转换为一个String值()。

-

Number value

-

primitive value corresponding to a double-precision 64-bit binary format IEEE 754-2008 value

+

Number值(Number value)

+

IEEE 754-2008格式的64位双精度二进制的原始值

-

A Number value is a member of the Number type and is a direct representation of a number.

+

一个数字值是数字类型的成员,直接代表一个数字。

-

Number type

-

set of all possible Number values including the special “Not-a-Number” (NaN) value, positive infinity, and negative infinity

+

Number类型(Number type)

+

所有可能的Number值的集合,包括特殊“Not-a-Number” (NaN) 值, 正无穷, 负无穷

-

Number object

-

member of the Object type that is an instance of the standard built-in `Number` constructor

+

Number对象(Number object)

+

标准内置构造器`Number`的一个实例,Object类型成员之一

-

A Number object is created by using the `Number` constructor in a `new` expression, supplying a number value as an argument. The resulting object has an internal slot whose value is the number value. A Number object can be coerced to a number value by calling the `Number` constructor as a function ().

+

通过使用`new`表达式,以一个数字值为参数调用`Number`构造器来创建Number对象。由此产生的对象包含一个值为此Number值的内部属性。将`Number`构造器作为一个函数来调用,可将一个Number对象强制转换为一个数字值()。

-

Infinity

-

number value that is the positive infinite number value

+

无穷(Infinity)

+

正无穷数值

-

NaN

-

number value that is an IEEE 754-2008 “Not-a-Number” value

+

NaN(NaN)

+

值IEEE 754-2008 “Not-a-Number”的数值

-

Symbol value

-

primitive value that represents a unique, non-String Object property key

+

Symbol值(Symbol value)

+

表示一个唯一的,非字符串的属性键对象的原始值

-

Symbol type

-

set of all possible Symbol values

+

Symbol类型(Symbol type)

+

所有可能的Symbol值集合

-

Symbol object

-

member of the Object type that is an instance of the standard built-in `Symbol` constructor

+

Symbol对象(Symbol object)

+

标准内置构造器`Symbol`的一个实例,Object类型成员之一

-

function

-

member of the Object type that may be invoked as a subroutine

+

函数(function)

+

可作为子程序调用的Object类型成员之一

-

In addition to its properties, a function contains executable code and state that determine how it behaves when invoked. A function's code may or may not be written in ECMAScript.

+

函数除了其属性,还包含可执行代码、状态,用来确定被调用时的行为。函数的代码不限于 ECMAScript。

-

built-in function

-

built-in object that is a function

+

内置函数(built-in function)

+

作为函数的内置对象

-

Examples of built-in functions include `parseInt` and `Math.exp`. An implementation may provide implementation-dependent built-in functions that are not described in this specification.

+

如 parseInt 和 Math.exp 就是内置函数。一个实现可以提供本规范没有描述的依赖于实现的内置函数。

-

property

-

part of an object that associates a key (either a String value or a Symbol value) and a value

+

属性(property)

+

将一个键(String值或Symbor值)和值相关联的对象的一部分

-

Depending upon the form of the property the value may be represented either directly as a data value (a primitive value, an object, or a function object) or indirectly by a pair of accessor functions.

+

属性可能根据属性值的不同表现为直接的数据值(原始值,对象,或一个函数对象)或间接的一对访问器函数。

-

method

-

function that is the value of a property

+

方法(method)

+

作为属性值的函数

-

When a function is called as a method of an object, the object is passed to the function as its *this* value.

+

当一个函数被作为一个对象的方法调用,此对象将作为`this`值传递给函数。

-

built-in method

-

method that is a built-in function

+

内置方法(built-in method)

+

作为内置函数的方法

-

Standard built-in methods are defined in this specification, and an ECMAScript implementation may specify and provide other additional built-in methods.

+

标准内置方法由本规范定义,ECMAScript 实现可指定,提供其他额外的内置方法。

-

attribute

-

internal value that defines some characteristic of a property

+

特性(attribute)

+

定义一个属性的一些特性的内部值

-

own property

-

property that is directly contained by its object

+

自身属性(own property)

+

对象直接拥有的属性

-

inherited property

-

property of an object that is not an own property but is a property (either own or inherited) of the object's prototype

+

继承属性(inherited property)

+

不是对象的自身属性,但是是对象原型的属性(原型的自身属性或继承属性)

- + -

Organization of This Specification

-

The remainder of this specification is organized as follows:

-

Clause 5 defines the notational conventions used throughout the specification.

-

Clauses 6-9 define the execution environment within which ECMAScript programs operate.

-

Clauses 10-16 define the actual ECMAScript programming language including its syntactic encoding and the execution semantics of all language features.

-

Clauses 17-26 define the ECMAScript standard library. They include the definitions of all of the standard objects that are available for use by ECMAScript programs as they execute.

+

本规范的结构

+

本规范的剩余部分章节组织如下:

+

第5章定义了在本规范中使用的一些符号或者语法的约定。

+

第6-9章定义了ECMAScript程序操作包含的执行环境。

+

第10-16章定义了实际的ECMAScript语言,包括它的语法编码以及语言特性的执行语义。

+

第17-26章定义了ECMAScript标准库。它们包括所有当ECMAScript程序执行时可用的标准对象的定义。

\ No newline at end of file diff --git a/translated/issues-7.html b/translated/issues-7.html index 172cb8dc9b..e894a8863d 100644 --- a/translated/issues-7.html +++ b/translated/issues-7.html @@ -1,84 +1,84 @@ -

Notational Conventions

+

符号约定

-

Syntactic and Lexical Grammars

+

语法与词法

-

Context-Free Grammars

-

A context-free grammar consists of a number of productions. Each production has an abstract symbol called a nonterminal as its left-hand side, and a sequence of zero or more nonterminal and terminal symbols as its right-hand side. For each grammar, the terminal symbols are drawn from a specified alphabet.

-

A chain production is a production that has exactly one nonterminal symbol on its right-hand side along with zero or more terminal symbols.

-

Starting from a sentence consisting of a single distinguished nonterminal, called the goal symbol, a given context-free grammar specifies a language, 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.

+

上下文无关文法

+

上下文无关文法由多个产生式组成。每个产生式左侧有一个称为非终结符的抽象符号的左值,右侧有一个或多个非终结符和终结符号组成的序列的右值。任何文法,它的终结符都来自指定的字母集。

+

一个产生式链是一个只含有一个非终结符以及0个或多个终结符作为其右值的产生式。

+

句子中单一可区分的非终结符——目标符,给定一个语言上下文无关文法。换句话说,重复用产生式右值替换序列中任何左值为非终结符所组成的终结符序列集合(可能是无限个)。

-

The Lexical and RegExp Grammars

-

A lexical grammar for ECMAScript is given in clause . This grammar has as its terminal symbols Unicode code points that conform to the rules for |SourceCharacter| defined in . It defines a set of productions, starting from the goal symbol |InputElementDiv|, |InputElementTemplateTail|, or |InputElementRegExp|, or |InputElementRegExpOrTemplateTail|, that describe how sequences of such code points are translated into a sequence of input elements.

-

Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and are called ECMAScript tokens. These tokens are the reserved words, 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 (). Simple white space and single-line comments are discarded and do not appear in the stream of input elements for the syntactic grammar. A |MultiLineComment| (that is, a comment of the form `/*`…`*/` regardless of whether it spans more than one line) is likewise simply discarded if it contains no line terminator; but if a |MultiLineComment| 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.

-

A RegExp grammar for ECMAScript is given in . This grammar also has as its terminal symbols the code points as defined by |SourceCharacter|. It defines a set of productions, starting from the goal symbol |Pattern|, that describe how sequences of code points are translated into regular expression patterns.

-

Productions of the lexical and RegExp grammars are distinguished by having two colons “::” as separating punctuation. The lexical and RegExp grammars share some productions.

+

词法与正则文法

+

ECMAScript词法文法给出。词法文法拥有符合定义的|SourceCharacter|规则的终结符Unicode码点。 它定义了一套产生式,从目标符|InputElementDiv|,|InputElementTemplateTail|,或|InputElementRegExp|,|InputElementRegExpOrTemplateTail|起始,描述如何将这样的字符序列翻译成一个输入元素序列。

+

空白和注释之外的输入元素构成ECMAScript语法文法的终结符,它们被称为ECMAScripttokens。这些tokens是,ECMAScript语言的保留字,标识符,字面量,标点符号。此外,行结束符虽然不被视为tokens,但会成为输入元素流的一部分,用于引导处理自动插入分号()。空白和单行注释会被简单的丢弃,不会出现在语法文法的输入元素的流中。如果一个|MultiLineComment|(即形式为`/*`…`*/`的注释,不管是否跨越多行)不包含行结束符也会简单地丢弃,但如果一个|MultiLineComment|包含一个或多个结束符,那么,注释会被替换为一个行结束符,成为语法文法输入元素流的一部分。

+

给出了ECMAScript的正则文法。此文法的终结符字符也由|SourceCharacter|定义。它定义了一套产生式,从目标符|Pattern|起始,描述了如何将这样的字符序列翻译成一个正则表达式模式。

+

两个冒号"::"作为分隔符分割词法和正则的文法产生式。词法和正则的文法共享某些产生式。

-

The Numeric String Grammar

-

Another grammar is used for translating Strings into numeric values. This grammar is similar to the part of the lexical grammar having to do with numeric literals and has as its terminal symbols |SourceCharacter|. This grammar appears in .

-

Productions of the numeric string grammar are distinguished by having three colons “:::” as punctuation.

+

数字字符串文法

+

用于转换字符串为数字值的一种文法。 此文法与数字字面量词法文法的一部分类似,并且有终结符|SourceCharacter|。此文法出现在

+

三个冒号":::"作为分隔符分割数字字符串文法的产生式。

-

The Syntactic Grammar

-

The syntactic grammar for ECMAScript is given in clauses 11, 12, 13, 14, and 15. This grammar has ECMAScript tokens defined by the lexical grammar as its terminal symbols (). It defines a set of productions, starting from two alternative goal symbols |Script| and |Module|, that describe how sequences of tokens form syntactically correct independent components of ECMAScript programs.

-

When a stream of code points is to be parsed as an ECMAScript |Script| or |Module|, 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 (|Script| or |Module|), with no tokens left over.

-

When a parse is successful, it constructs a parse tree, a rooted tree structure in which each node is a Parse Node. Each Parse Node is an instance 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 goal symbol. 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 children, 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.

-

Productions of the syntactic grammar are distinguished by having just one colon “:” as punctuation.

-

The syntactic grammar as presented in clauses 12, 13, 14 and 15 is not a complete account of which token sequences are accepted as a correct ECMAScript |Script| or |Module|. 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.

-

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 |Script| or |Module|. For example, this technique is used for object literals and object destructuring patterns. In such cases a more restrictive supplemental grammar is provided that further restricts the acceptable token sequences. Typically, an early error rule will then define an error condition if "_P_ cannot be reparsed as an _N_", where _P_ is a Parse Node (an instance of the generalized production) and _N_ is a nonterminal from the supplemental grammar. Here, the sequence of tokens originally matched by _P_ is parsed again using _N_ as the goal symbol. (If _N_ takes grammatical parameters, then they are set to the same values used when _P_ was originally parsed.) An error occurs if the sequence of tokens cannot be parsed as a single instance of _N_, with no tokens left over. Subsequently, algorithms access the result of the parse using a phrase of the form "the result of reparsing _P_ as an _N_". This will always be a Parse Node (an instance of _N_), since any parsing failure would have been detected by an early error rule.

+

语法文法

+

第 11,12,13,14 章给出了ECMAScript的语法文法。词法文法定义的ECMAScript tokens是此文法的终结符()。它定义了一系列的产生式,从两个可选的目标符号|Script|以及|Module|开始,描述形成ECMAScript程序语法上正常的独立的组件的token是怎样的序列。

+

当一个码点流解析成一个ECMAScript的Script或者Module时,它首先被词法文法程序转换成一个输入元素流;然后使用一个单一语法文法程序解析这个输入元素流。存在语法错误——输入元素流中的token不能被解析成一个单一的目标非终结符(|Script|或者|Module|)——的输入流,将不会留下任何token。

+

当一个解析成功的时候,它会构造一颗解析树(parse tree),一颗根树结构是它的每个节点都是一个Parse Node。每个Parse Node都是文法中的一个符号的一个实例。它代表了从这样的符号中派生出来的源代码文本的一个跨度。解析树的根节点代表着整个的源代码文本,是解析的目标符的一个实例。当一个Parse Node是一个非终结符的实例的时候,它也是某些左值为非终结符的产生式的一个实例。此外,它有0个或多个孩子,产生式右值中的每个符号:每个孩子的Parse Node都是相应符号的一个实例。

+

只用一个冒号“:”作为分隔符分割语法词法的产生式。

+

语法文法在条款12,13,14以及15中提出。但是对于哪些token序列是正确的被ECMAScript |Script|或者|Module|接受的解释得并不完整。一些额外的token序列也能被接受,换句话说,那些序列将会被文法描述,只要分号被加入到序列中的某些地方(比如在行终结符之前)。此外,某些通过文法描述的token序列不会被接受,如果一个行终结符出现在某些“awkward”的地方。

+

在某些情况下,为了避免歧义,语法文法使用广义的产生式,允许token序列不形成一个合法的ECMAScript |Script|或者|Module|。例如,此技术被用作对象字面量和对象解构模式中。在这种情况下,提供了更加限制性的补充文法,其进一步限制可接受的token序列。通常,一个早期错误规则将会定义一个错误条件是否"_P_不能像一个_N_被重解析",其中_P_是Parse Node(普通产生式的一个实例),_N_是补充文法的非终结符。这里,最初与_P_匹配的token序列被再次用_N_作为目标符号解析。(如果_N_使用语法参数,则将它们设置为当_P_最初解析时使用的相同值)。如果token序列不能被解析为_N_的一个单一实例,则会产生错误,将不会留下任何token。随后,算法访问"像一个_N_重新解析_P_的结果"的短语的解析结果。这将始终是一个解析节点(_N_的一个实例),因此任何解析失败都将被一个早期错误规则检测到。

-

Grammar Notation

-

Terminal symbols of the lexical, RegExp, and numeric string grammars are shown in `fixed width` font, both in the productions of the grammars and throughout this specification whenever the text directly refers to such a terminal symbol. These are to appear in a script 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 range, as opposed to any similar-looking code points from other Unicode ranges.

-

Nonterminal symbols are shown in italic 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:

+

文法标记法

+

不管是在文法的产生式,还是在本规范中,词法文法,正则文法以及数字字符串文法的终结符都用等宽字体展示。这些将以的脚本形式出现。所有通过这种方式指定的终结符码点都被当作合适的基本拉丁语Unicode码点理解,而不是来自其他任何类似Unicode范围的码点。

+

非终结符以斜体显示。非终结符(也叫产生式)的定义由非终结符名称和其后定义的一个或多个冒号给出。(冒号的数量表示产生式所属的文法。)非终结符的一个或多个替代右值紧跟在下一行。例如,语法定义:

WhileStatement : `while` `(` Expression `)` Statement -

states that the nonterminal |WhileStatement| represents the token `while`, followed by a left parenthesis token, followed by an |Expression|, followed by a right parenthesis token, followed by a |Statement|. The occurrences of |Expression| and |Statement| are themselves nonterminals. As another example, the syntactic definition:

+

表示这个非终结符|WhileStatement|代表`while`token,其后跟左括号`token`,其后跟|Expression|,其后跟右括号`token`,其后跟|Statement|。这里出现的|Expression|和|Statement|本身是非终结符。另一个例子,语法定义:

ArgumentList : AssignmentExpression ArgumentList `,` AssignmentExpression -

states that an |ArgumentList| may represent either a single |AssignmentExpression| or an |ArgumentList|, followed by a comma, followed by an |AssignmentExpression|. This definition of |ArgumentList| is recursive, that is, it is defined in terms of itself. The result is that an |ArgumentList| may contain any positive number of arguments, separated by commas, where each argument expression is an |AssignmentExpression|. Such recursive definitions of nonterminals are common.

-

The subscripted suffix “opt”, 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:

+

表示这个|ArgumentList|可以代表一个|AssignmentExpression|,或|ArgumentList|,其后跟一个逗号,其后跟一个|AssignmentExpression|。这个|ArgumentList|的定义是递归的,也就是说,它定义它自身。其结果是,一个|ArgumentList|可能包含用逗号隔开的任意正数个参数,每个参数表达式是一个|AssignmentExpression|。这样,非终结符共用了递归的定义。

+

终结符或非终结符可能会出现后缀下标“opt”,表示它是可选符号。包含可选符号实际指定了包含两个右值,一个是省略可选元素的,另一个是包含可选元素的。这意味着:

VariableDeclaration : BindingIdentifier Initializer? -

is a convenient abbreviation for:

+

是以下的一种缩写:

VariableDeclaration : BindingIdentifier BindingIdentifier Initializer -

and that:

+

以及:

IterationStatement : `for` `(` LexicalDeclaration Expression? `;` Expression? `)` Statement -

is a convenient abbreviation for:

+

是以下的一种缩写:

IterationStatement : `for` `(` LexicalDeclaration `;` Expression? `)` Statement `for` `(` LexicalDeclaration Expression `;` Expression? `)` Statement -

which in turn is an abbreviation for:

+

以下也是一种缩写:

IterationStatement : `for` `(` LexicalDeclaration `;` `)` Statement @@ -86,89 +86,89 @@

Grammar Notation

`for` `(` LexicalDeclaration Expression `;` `)` Statement `for` `(` LexicalDeclaration Expression `;` Expression `)` Statement
-

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

-

A production may be parameterized by a subscripted annotation of the form “[parameters]”, which may appear as a suffix to the nonterminal symbol defined by the production. “parameters” 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:

+

所以在这个例子中,非终结符|IterationStatement|实际上有四个可供选择的右值。

+

产生式可以通过形如“[parameters]”这样的下标注释被参数化,会以后缀的形式出现在产生式定义的非终结符中。“parameters”可以是单独的名称,也可以是一个逗号分隔的名称列表。被参数化的产生式是一系列定义参数名称以下划线开头,追加到参数化的非终结符后面的所有组合的产生式的缩写。这就意味着:

StatementList[Return] : - ReturnStatement + ReturnStatement ExpressionStatement -

is a convenient abbreviation for:

+

是下面的缩写:

StatementList : - ReturnStatement + ReturnStatement ExpressionStatement - + StatementList_Return : - ReturnStatement + ReturnStatement ExpressionStatement -

and that:

+

以及:

StatementList[Return, In] : - ReturnStatement + ReturnStatement ExpressionStatement -

is an abbreviation for:

+

是下面的缩写:

StatementList : - ReturnStatement + ReturnStatement ExpressionStatement StatementList_Return : - ReturnStatement + ReturnStatement ExpressionStatement StatementList_In : - ReturnStatement + ReturnStatement ExpressionStatement StatementList_Return_In : - ReturnStatement + ReturnStatement ExpressionStatement -

Multiple parameters produce a combinatory number of productions, not all of which are necessarily referenced in a complete grammar.

-

References to nonterminals on the right-hand side of a production can also be parameterized. For example:

+

多个参数产生数个产生式的组合,在一个完整语法中不必引用所有。

+

对生产式的非终结符右值的引用也可以被参数化,例如:

StatementList : - ReturnStatement + ReturnStatement ExpressionStatement[+In] -

is equivalent to saying:

+

是下面的缩写:

StatementList : - ReturnStatement + ReturnStatement ExpressionStatement_In -

and:

+

又如:

StatementList : - ReturnStatement + ReturnStatement ExpressionStatement[~In] -

is equivalent to:

+

是下面的缩写:

StatementList : ReturnStatement ExpressionStatement -

A nonterminal reference may have both a parameter list and an “opt” suffix. For example:

+

非终结符引用可能同时具有参数列表和一个“opt”后缀。例如:

VariableDeclaration : BindingIdentifier Initializer[+In]? -

is an abbreviation for:

+

是下面的缩写:

VariableDeclaration : BindingIdentifier BindingIdentifier Initializer_In -

Prefixing a parameter name with “?” 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:

+

在右侧非终结符引用参数名称前置以“?”,使该参数值取决于当前产生式的左侧符号引用的参数名称是否出现。例如:

VariableDeclaration[In] : BindingIdentifier Initializer[?In] -

is an abbreviation for:

+

是下面的缩写:

VariableDeclaration : BindingIdentifier Initializer @@ -176,13 +176,13 @@

Grammar Notation

VariableDeclaration_In : BindingIdentifier Initializer_In
-

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 not used in referencing the production's nonterminal symbol. This means that:

+

如果右值选择是以“[+parameter]”作为前缀,则表示选择只有命名参数用于引用产生式的非终结符时可用。如果右值选择是以“[\~parameter]”作为前缀,则表示选择只有命名参数不是用于引用产生式的非终结符时可用。这意味着:

StatementList[Return] : [+Return] ReturnStatement ExpressionStatement -

is an abbreviation for:

+

是下面的缩写:

StatementList : ExpressionStatement @@ -191,13 +191,13 @@

Grammar Notation

ReturnStatement ExpressionStatement
-

and that:

+

另外一个例子:

StatementList[Return] : [~Return] ReturnStatement ExpressionStatement -

is an abbreviation for:

+

是下面的缩写:

StatementList : ReturnStatement @@ -206,12 +206,12 @@

Grammar Notation

StatementList_Return : ExpressionStatement
-

When the words “one of” 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:

+

在文法定义中当单词“one of”跟随一个或多个分号后的时候,表示随后的一行或多行的终结符是一个可选的定义。例如,ECMAScript的词法文法包含下列的产生式:

NonZeroDigit :: one of `1` `2` `3` `4` `5` `6` `7` `8` `9` -

which is merely a convenient abbreviation for:

+

它仅仅是下面的缩写:

NonZeroDigit :: `1` @@ -224,40 +224,40 @@

Grammar Notation

`8` `9`
-

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.

-

If the phrase “[lookahead ∉ _set_]” appears in the right-hand side of a production, it indicates that the production may not be used if the immediately following input token sequence is a member of the given _set_. The _set_ can be written as a comma separated list of one or two element terminal sequences enclosed in curly brackets. For convenience, the set can also be written as a nonterminal, in which case it represents the set of all terminals to which that nonterminal could expand. If the _set_ consists of a single terminal the phrase “[lookahead ≠ _terminal_]” may be used.

-

For example, given the definitions:

+

如果“[empty]” 出现在一个产生式的右值,它暗示着这个产生式的右值不包含终结符或者非终结符。

+

如果“[lookahead ∉ _set_]”出现在一个产生式的右值,它暗示着如果随后立即的输入的token序列是给出的集合(_set_)的成员,那么这个产生式也许不会被使用。这个集合可以用一个逗号分割的由一到两个被花括号包裹的元素终结序列的列表表示。为了方便,这个集合也可以用非终结符表示,在这种情况下,它代表所有能由非终结符展开得到的终结符的集合。如果这个集合包含一个单独的终结符,那么短语“[lookahead ≠ _terminal_]”也许会被使用。

+

例如,给出定义:

DecimalDigit :: one of - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` DecimalDigits :: DecimalDigit DecimalDigits DecimalDigit -

the definition:

+

则定义:

LookaheadExample :: `n` [lookahead <! {`1`, `3`, `5`, `7`, `9`}] DecimalDigits DecimalDigit [lookahead <! DecimalDigit] -

matches either the letter `n` followed by one or more decimal digits the first of which is even, or a decimal digit not followed by another decimal digit.

-

Similarly, if the phrase “[lookahead ∈ _set_]” appears in the right-hand side of a production, it indicates that the production may only be used if the immediately following input token sequence is a member of the given _set_. If the _set_ consists of a single terminal the phrase “[lookahead = _terminal_]” may be used.

-

If the phrase “[no |LineTerminator| here]” appears in the right-hand side of a production of the syntactic grammar, it indicates that the production is a restricted production: it may not be used if a |LineTerminator| occurs in the input stream at the indicated position. For example, the production:

+

能匹配字母 n 后跟随由偶数起始的一个或多个十进制数字,或一个十进制数字后面跟随一个非十进制数字。

+

类似的,如果产生式的右值出现“[lookahead ∈ _set_]”,则表示产生式只有在随后立即的输入的token序列是给出的集合(_set_)的成员才能使用。如果集合只包含一个单一的终结符,则可以使用“[lookahead == _terminal_]”。

+

如果产生式的右侧出现“[no |LineTerminator| here]”,那么它表示此产生式是个受限的产生式:如果|LineTerminator|在输入流的指定位置出现,那么此产生式将不会被适用。例如,产生式:

ThrowStatement : `throw` [no LineTerminator here] Expression `;` -

indicates that the production may not be used if a |LineTerminator| occurs in the script between the `throw` token and the |Expression|.

-

Unless the presence of a |LineTerminator| is forbidden by a restricted production, any number of occurrences of |LineTerminator| may appear between any two consecutive tokens in the stream of input elements without affecting the syntactic acceptability of the script.

-

When an alternative in a production of the lexical grammar or the numeric string grammar appears to be a multi-code point token, it represents the sequence of code points that would make up such a token.

-

The right-hand side of a production may specify that certain expansions are not permitted by using the phrase “but not” and then indicating the expansions to be excluded. For example, the production:

+

如果一个|LineTerminator|出现在脚本的`throw`token和|Expression|之间的时候,暗示着这个产生式也许不会被使用。

+

除非通过一个受限的产生式禁止一个|LineTerminator|的出现,否则任意数量|LineTerminator|的出现也许会发生在输入元素流中任意两个连续的token之间,并且不影响脚本的语义可接受性。

+

当一个词法文法或者数字字符串文法的产生式中可选部分出现多码点的token时,意味着码点序列将会组成一个token。

+

一个产生式的右值也许会通过“but not”指定某些不被允许的扩展,然后暗示这个扩展将是被排除在外的。例如,产生式:

Identifier :: IdentifierName but not ReservedWord -

means that the nonterminal |Identifier| may be replaced by any sequence of code points that could replace |IdentifierName| provided that the same sequence of code points could not replace |ReservedWord|.

-

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:

+

意味着非终结符|Identifier|也许会被任意的码点序列替换,这些码点能够替换提供的|IdentifierName|,但是相同序列的码点不能替换|ReservedWord|。

+

最后,一些非终结符通过sans-serif字体书写的描述性的短语来描述, 在这样的案例中,列出所有的可选部分是不切实际的。

SourceCharacter :: > any Unicode code point diff --git a/translated/issues-8.html b/translated/issues-8.html index 511872c4a1..c4dc2c1b0f 100644 --- 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 语言结构所需的语义。该算法无意暗示任何具体实现使用的技术。在实践中,也许可用更有效的算法实现一个给定功能。

+

算法也许被显式的参数化,在这些案例中参数的名称和用法必须作为算法定义的一部分提高。

+

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

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的完成记录。除非它是上下文中另外非常明显的部分,一个返回一个值的算法语句,那么这个值将不是一个完成值。例如:

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”语句的值表达式是一个完成记录构造的字面量,那么完成记录的结果将被返回。如果这个值表达式是一个对抽象操作的调用,那么“return”语句简单地返回这个抽象操作产生的完成记录。

+

抽象操作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. + 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:

+

返回

+

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

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需要被应用到结果的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_。

+

The mathematical functionfloor(_x_) produces the largest integer (closest to positive infinity) that is not larger than_x_.

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