李洋学习笔记-ECMA262翻译(二)

阅读数:1793 发布时间:2016-06-01 19:38:24

作者:zzl005 标签: 李洋 ECMA 委培班 w1 翻译 javascript 英语单词

ECMA262翻译笔记(二)

Executable Code and Execution Contexts

可执行代码和执行上下文

A Lexical Environment is a specification type used to define the association of Identifiers to specific variables and functions based upon the lexical nesting structure of ECMAScript code. A Lexical Environment consists of an Environment Record and a possibly null reference to an outer Lexical Environment. Usually a Lexical Environment is associated with some specific syntactic structure of ECMAScript code such as a FunctionDeclaration, a BlockStatement, or a Catch clause of a TryStatement and a new Lexical Environment is created each time such code is evaluated.

词法环境是用于定义标识符基于ECMAScript中的代码的词法嵌套结构的特定变量和函数协会的规范类型。词法环境由一个环境记录和一个可能空引用到外部词法环境组成。通常一个词法环境与ECMAScript中的一些代码特定的句法结构相关,如FunctionDeclaration,一个块语句,或TryStatement的catch子句和每次这样的代码进行评估时一个新的词法环境被创建。

An Environment Record records the indentifier bindings that are created within the scope of its associated Lexical Environment.It is referred to as the Lexical Environment's EnvironmentRecord.

一个环境记录记录了被其相关联的词法环境的范围内建立的标识符的绑定。它被称为词法环境的EnvironmentRecord

The outer environment reference is used to model the logical nesting of Lexical Environment values. The outer reference of a (inner) Lexical Environment is a reference to the Lexical Environment that logically surrounds the inner Lexical Environment. An outer Lexical Environment may, of course, have its own outer Lexical Environment. A Lexical Environment may serve as the outer environment for multiple inner Lexical Environments. For example, if a FunctionDeclaration contains two nested FunctionDeclarations then the Lexical Environments of each of the nested functions will have as their outer Lexical Environment the Lexical Environment of the current evaluation of the surrounding function.

外部环境引用用于词法环境值的逻辑嵌套模型。(内)词法环境的外部引用是对词法环境的参考逻辑上包围内词法环境。外词法环境可以,当然有其自身的外部词法环境。词法环境可作为多个内部词法环境的外部环境。例如,如果一个函数声明包含两个嵌套函数声明然后每个嵌套函数的词法环境将具有与其外词法环境周边功能的当前评价的词法环境。

A global environment is a Lexical Environment which does not have an outer environment. The global environment’s outer environment reference is null. A global environment’s EnvironmentRecord may be prepopulated with identifier bindings and includes an associated global object whose properties provide some of the global environment’s identifier bindings. This global object is the value of a global environment’s this binding. As ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be modified.

全局环境是一个词法环境没有外部环境。全局环境的外部环境的引用是null。全局环境的环境记录可预填充识别绑定,并包括一个相关的全局对象,其属性提供一些全局环境的标识符绑定。这个全局对象是全局环境中的this绑定的值。作为被执行的ECMAScript代码,附加属性可被添加到全局对象和初始特性可以被修改。

A module environment is a Lexical Environment that contains the bindings for the top level declarations of a Module. It also contains the bindings that are explicitly imported by the Module. The outer environment of a module environment is a global environment.

一个模块环境是一个词法环境包括为顶级模块声明的绑定。它还包含了明确的模块导入的绑定。一个模块环境的外部环境是一个全局的环境

A function environment is a Lexical Environment that corresponds to the invocation of an ECMAScript function object. A function environment may establish a new this binding. A function environment also captures the state necessary to support super method invocations.

函数环境是对应于一个ECMAScript函数对象的调用一个词法环境。函数环境可以建立一个新this绑定。函数环境也捕获有必要支持super方法调用的状态

Lexical Environments and Environment Record values are purely specification mechanisms and need not correspond to any specific artefact of an ECMAScript implementation. It is impossible for an ECMAScript program to directly access or manipulate such values.

词法环境和环境记录值是纯粹的规范机制,不必对应于ECMAScript实现的任何具体的假象。这是不可能的ECMAScript程序直接访问或操纵这样的值。


词汇总结

单词 翻译
lexical 词法
association 关联
identifier 标示符
specific 特定的,具体的
nesting structure 嵌套结构
consists 由...组成
syntactic 句法
evaluate 评估,计算
logically 逻辑
explicitly 显然的
clause 子句,从句
reference 引用
multiple 多次,多重
prepopulate 预填充
additional 附加的,额外的
modify 修改
explicitly 明确的
corresponds 对应
pure 纯的
artefact 假象
implementation 实现
capture 捕获
invocation 调用

相关文章推荐: