GATE 2012 CS (CS1) – Question 63
S→aAbB | bAaB | ε; A→S; B→S. The partial predictive table has S row (E1,E2,S→ε), A row (A→S,A→S,error), B row (B→S,B→S,E3), for lookaheads a,b,end-marker respectively. Find E1,E2,E3.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) E1={S→aAbB,S→ε}; E2={S→bAaB,S→ε}; E3=B→S
Explanation
The a-leading and b-leading S alternatives enter E1 and E2 respectively. Since S is nullable and a,b belong to FOLLOW(S), S→ε also enters both cells, revealing LL(1) conflicts. B→S is nullable and the end-marker belongs to FOLLOW(B), so E3 is B→S. These entries are C; the grammar is not conflict-free LL(1).