5 Notational Conventions 5符號慣例

5 Notational Conventions

5符號慣例
 
5.1 Syntactic and Lexical Grammars
5.1句法和詞彙語法
 
5.1.1 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.

閱讀全文:5 Notational Conventions 5符號慣例

4.3 Terms and definitions 名稱與定義

4.3 Terms and definitions

For the purposes of this document, the following terms and definitions apply.
4.3.1
type
set of data values as defined in Clause 8 of this specification
4.3.2
primitive value
member of one of the types Undefined, Null, Boolean, Number, or String as defined in Clause 8
NOTE A primitive value is a datum that is represented directly at the lowest level of the language implementation.
4.3.3
object
member of the type Object
NOTE An object is a collection of properties and has a single prototype object. The prototype may be the null value.
 
4.3名稱與定義
下面的名稱與定義適用於這文件的議題。
4.3.1
類型
在本規範書條款8中所定義的資料值組。
4.3.2
原始值
下面的類型中的一種,Undefined, Null, Boolean, Number,String,這些類型定義在條款8。
注意,原始值是在語言實現的最低層表示的數據。
4.3.3
物件
類型(4.3.1)物件中的成員
注意,物件是屬性的集合,並且擁有單一的原型物件。原型可能是null。

4.2.2 The Strict Variant of ECMAScript ECMAScript的嚴格版本

4.2.2 The Strict Variant of ECMAScript

The ECMAScript Language recognises 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.
 
4.2.2 ECMAScript的嚴格版本
ECMAScript 語言承認一個可能性,某些語言的使用者會希望限制語言中的一些特徵的用途。這樣做的目的可能是為了安全性,或是避免他門認為容易產生錯誤的特徵,強化錯誤檢查,或是其他選擇的理由。為了這個可能性,ECMAScript為這語言定義了一個嚴格的版本。此語言的嚴格版本包含了一些特殊的語法與語意特徵,這些特徵都是正規的ECMAScript語言,並修改了這些特徵語意的細節。嚴格版本也指明了額外的錯誤狀態,這些錯誤狀態必須藉由丟出例外來回報,這些情況在語言的非嚴格類型中,並不會指明為錯誤。

4.2 Language Overview 語言概述

4.2 Language 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. An ECMAScript object is a collection of properties each with zero or more 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 change the value of 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, and String; an object is a member of the remaining built-in type Object; and a function is a callable object. A function that is associated with an object via a property is a method.
 
4.2 語言概述
下面是一個ECMAScript的非正式概述—並非語言的所有部分都會提到。這份概述並不是標準本身的一部分。
ECMAScript是基於物件的:基本語言和主機功能都是由物件提供,ECMAScript程式是一群可互相溝通的物件。ECMAScript物件是一群屬性的集合,每個屬性都有0個或多個特徵,這些特徵決定每個屬性能夠如何被使用。譬如說,當某個屬性的可寫特徵被設成false,任何藉由執行ECMAScript程式碼來改變屬性值的企圖都會失效。屬性是個容器,能夠裝載其他的物件、原始值或是函式。原始值是下面內建型態中的一個成員(原始值是下面內建型態的其中一種):未定義(Undefined), 空(Null), 布林(Boolean), 數值(Number), and 字串(String);物件是其餘內建型態物件中的成員,函式是一個可呼叫的物件。經由屬性連結到物件的函式稱之為方法(method)。

4.1 Web Scripting 網頁腳本語言

4.1 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
 
4.1網頁腳本語言
網頁瀏覽器提供了ECMAScript主機環境以進行客戶端運算,譬如,用來表示視窗,選單,彈出,對話盒,本文區域,瞄點,框架,歷史,cookies,以及輸入輸出的物件。更進一步來說,主機環境提供了一種方法,以進行腳本語言程式碼的附加,像是焦點的改變,網頁與圖像的載入、卸載、錯誤以及放棄,選擇清單與表單提交,和滑鼠動作等。腳本描述語言出現在HTML當中,顯示出來的頁面是由使用者介面元素以及固定和計算出的文字與圖像組合而成。這種腳本描述語言是依據使用者的互動進行反應,因此他並不需要一個主程式。

4.Overview 概觀

4 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 host 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.
 
4.概觀
這章節包含了一個非規範性的ECMAScript語言概述。
ECMAScript是一個物件導向的程式語言,可以在主機環境中進行運算與操作計算機物件。此處定義的ECMAScript並不是為了成為一個計算機的自給自足的語言,更確切的說,這份規範書並沒有提到任何關於外部資料輸入或是計算結果輸出的條款。相反的,此處定義的ECMAScript認為執行ECMAScript程式的計算機環境將不只提供此規範書定義的物件以及其他描述到的功能,還要提供某些特定環境的主機物件,除了指定能被存取的某些屬性,以及能被ECMAScript呼叫的程式外,這些主機物件的描述以及功能並不沒有在此規範書的範圍。