ECMAScript 符号语法的含义?
Meaning of ECMAScript notation syntax?
我不知道如何正确阅读 this syntax line。
- 为什么
IdentifierName
是用 IdentifierName
定义的?
- 为什么在定义的中间有一个新行?
这个符号怎么读?
Syntax
IdentifierName ::
IdentifierStart
IdentifierName IdentifierPart
这是一个递归定义,这在语法符号中并不少见。
IdentifierName
由IdentifierStart
或IdentifierName IdentifierPart
组成。如果我们再次在第二个备选方案中展开 IdentifierName
,我们会得到
IdentifierStart IdentifierPart
IdentifierName IdentifierPart IdentifierPart
等等。
用非正式的方式表达:IdentifierName
由 IdentifierStart
后跟任意数量的 IdentifierPart
组成。
As another example, the syntactic definition:
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.
我不知道如何正确阅读 this syntax line。
- 为什么
IdentifierName
是用IdentifierName
定义的? - 为什么在定义的中间有一个新行?
这个符号怎么读?
Syntax
IdentifierName :: IdentifierStart IdentifierName IdentifierPart
这是一个递归定义,这在语法符号中并不少见。
IdentifierName
由IdentifierStart
或IdentifierName IdentifierPart
组成。如果我们再次在第二个备选方案中展开 IdentifierName
,我们会得到
IdentifierStart IdentifierPart
IdentifierName IdentifierPart IdentifierPart
等等。
用非正式的方式表达:IdentifierName
由 IdentifierStart
后跟任意数量的 IdentifierPart
组成。
As another example, the syntactic definition:
ArgumentList: AssignmentExpression ArgumentList,AssignmentExpression
states that an
ArgumentList
may represent either a singleAssignmentExpression
or anArgumentList
, followed by a comma, followed by anAssignmentExpression
. This definition ofArgumentList
is recursive, that is, it is defined in terms of itself. The result is that anArgumentList
may contain any positive number of arguments, separated by commas, where each argument expression is anAssignmentExpression
. Such recursive definitions of nonterminals are common.