对于下面的语法,还提供了部分LL(1)解析表以及该语法。需要填写的条目分别表示为E1,E2和E3。 是空字符串,$表示输入的结尾,并且|分隔作品的其他右侧。
(A) A
(B) B
(C) C
(D) D答案: (A)
解释:
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.
这个问题的测验