【发布时间】:2018-09-17 09:12:55
【问题描述】:
我正在尝试计算以下语法的 FOLLOW 集:
E -> TX
T -> int Y | ( E )
X -> + E | ε
Y -> * T | ε
到目前为止,我已经计算出以下 FOLLOW 集:
follow (E) = {$} U {)}
follow (Y) = follow (T)
follow (T) = follow (Y)
follow (X) = follow (E) = {$, )}
follow (E) = first ()) = {)}
我知道 follow (T) / follow (Y) 包含 {+,$,)} 但我正在努力达到这一点。
在此处解释该方法的任何帮助都会非常有帮助。
注意:我已遵守这些规则
1) If A is the start symbol put $ in Follow (A)
2) If there is a production B -> αAb, then Follow (A) = First (b)
3) If there is a production B -> aA or B -> αAb where First (b) is ε, add Follow (A) = Follow (B)
【问题讨论】:
-
可能你的语法不完整。
)来自哪里? -
你错了!谢谢。
标签: parsing compiler-construction set grammar set-theory