[英]Grammar Follow Set Explanation
I'm looking at the following simple grammar and its accompanying table: 我正在查看以下简单语法及其附表:
S-> aSbT | epsilon
T-> bFaF | epsilon
F-> epsilon
nonterminal first set follow set
S a b
T b b
F ∅ a b
Could someone please explain why b, but not a, is in the follow set of T? 有人可以解释为什么b,但不是a,是在T的后续集合?
Take a look here for a good explanation of how first and follow sets are computed. 看看这里有关如何计算第一组和跟随集的一个很好的解释。
The third rule for Follow sets applies when you compute Follow(T) (because T is appears only in the first production and nothing follows after it). 当你计算Follow(T)时,适用跟随集的第三条规则(因为T只出现在第一个生产中,后面没有任何内容)。 Then you will put everything from Follow(S) in Follow(T). 然后你将把Follow(S)中的所有东西放在Follow(T)中。
Follow(S) = {b}, then Follow(T) = {b}. 遵循(S)= {b},然后跟随(T)= {b}。
I think in Follow(S) should also be $ (or epsilon) if S is the starting symbol of your grammar. 如果S是你的语法的起始符号,我认为在Follow(S)中也应该是$(或epsilon)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.