UGC NET CS 2011 June-Paper-2
October 3, 2023Compiler-Design
October 3, 2023Compiler-Design
Question 1 |
Consider the grammar given below:
S → Aa
A → BD
B → b | ε
D → d | ε
Let a, b, d and $ be indexed as follows:
Compute the FOLLOW set of the non-terminal B and write the index values for the symbols in the FOLLOW set in the descending order. (For example, if the FOLLOW set is {a, b, d, $}, then the answer should be 3210)
S → Aa
A → BD
B → b | ε
D → d | ε
Let a, b, d and $ be indexed as follows:
Compute the FOLLOW set of the non-terminal B and write the index values for the symbols in the FOLLOW set in the descending order. (For example, if the FOLLOW set is {a, b, d, $}, then the answer should be 3210)
30 | |
31 | |
10 | |
21 |
Question 1 Explanation:
Follow(B) = First(D) Union Follow(A)
{Follow(B) = Follow(A) when D is epsilon}
Follow(B) = {d} Union {a} = {a,d}
Hence Answer is : 31
{Follow(B) = Follow(A) when D is epsilon}
Follow(B) = {d} Union {a} = {a,d}
Hence Answer is : 31
Correct Answer: B
Question 1 Explanation:
Follow(B) = First(D) Union Follow(A)
{Follow(B) = Follow(A) when D is epsilon}
Follow(B) = {d} Union {a} = {a,d}
Hence Answer is : 31
{Follow(B) = Follow(A) when D is epsilon}
Follow(B) = {d} Union {a} = {a,d}
Hence Answer is : 31