【发布时间】:2018-03-08 11:30:47
【问题描述】:
我正在尝试编写 Swift 语言亮点。除了一些语言结构的标记之外,我还想强调一下。以下规则有问题:
Type
: '[' Type ']'
| '[' Type ':' Type ']'
| (Attributes? Function_type_argument_clause 'throws'? '->' Type | Attributes? Function_type_argument_clause 'rethrows' '->' Type)
| (Type_name Generic_argument_clause? | Type_name Generic_argument_clause? '.' Type)
| Tuple_type
| Type '?'
| Type '!'
| (Type_name Generic_argument_clause? | Type_name Generic_argument_clause? '.' Type) '&' Protocol_composition_continuation
| (Type '.' 'Type' | Type '.' 'Protocol')
| 'Any'
| 'Self'
| '(' Type ')'
;
错误:以下规则集是相互左递归的[类型]
试图在规则中离开,只有以下几种情况:
Type
: Type '?'
| 'Any'
| 'Self'
;
但问题依然存在:以下几组规则是相互左递归的[Type]
【问题讨论】: