GATE | GATE CS 2012 | Question 65

For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. \epsilon is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.


(A) A
(B) B
(C) C
(D) D

Answer: (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

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.

Quiz of this Question

GATE CS Corner    Company Wise Coding Practice

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.