对于下面的语法,部分 LL(1) 解析表也随语法一起呈现。需要填写的条目表示为E1、E2和E3。 是空字符串,$ 表示输入结束,而,|分隔作品的交替右侧。
(一) A
(乙)乙
(C)丙
(四)丁答案:(一)
解释:
First(X) - It is the set of terminals that begin the
strings derivable from X.
Follow(X) - It is the set of terminals that can appear
immediately to the right of X in some sentential
form.
Now in the above question,
FIRST(S) = { a, b, epsilon}
FIRST(A) = FIRST(S) = { a, b, epsilon}
FIRST(B) = FIRST(S) = { a, b, epsilon}
FOLLOW (A) = { b , a }
FOLLOW (S) = { $ } U FOLLOW (A) = { b , a , $ }
FOLLOW (B) = FOLLOW (S) = { b ,a , $ }
epsilon corresponds to empty string.
这个问题的测验