【发布时间】:2013-10-15 16:21:05
【问题描述】:
我尝试阅读 SLS,但它有一些奇怪的类似 BNF 的符号。任何人都可以澄清这个符号。例如类型章节有以下内容:
Type ::= FunctionArgTypes ‘=>’ Type
| InfixType [ExistentialClause]
FunctionArgTypes ::= InfixType
| ‘(’ [ ParamType {‘,’ ParamType } ] ‘)’
ExistentialClause ::= ‘forSome’ ‘{’ ExistentialDcl {semi ExistentialDcl} ‘}’
ExistentialDcl ::= ‘type’ TypeDcl
| ‘val’ ValDcl
InfixType ::= CompoundType {id [nl] CompoundType}
CompoundType ::= AnnotType {‘with’ AnnotType} [Refinement]
| Refinement
AnnotType ::= SimpleType {Annotation}
SimpleType ::= SimpleType TypeArgs
| SimpleType ‘#’ id | StableId
| Path ‘.’ ‘type’
| ‘(’ Types ’)’
TypeArgs ::= ‘[’ Types ‘]’
Types ::= Type {‘,’ Type}
::= 和 | 这样的符号我很清楚,但 [] 和 {} 之间的区别是什么。我也找不到id、[nl]、Refinment、Type 之类的描述。
【问题讨论】:
标签: scala specifications