📜  门|门CS 2012 |第 65 题

📅  最后修改于: 2021-09-25 07:15:52             🧑  作者: Mango

对于下面的语法,部分 LL(1) 解析表也随语法一起呈现。需要填写的条目表示为E1、E2和E3。 \epsilon是空字符串,$ 表示输入结束,而,|分隔作品的交替右侧。

CSE_2012_51

CSE_GATE_20122
(一) 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.

这个问题的测验