Similar questions 7 more →
Parsing & Syntax Analysis
![Question 58, GATE 2006: For grammar S→FR, R→*S|ε, F→id, what are predictive-table entries M[S,id] and M[R,$], respectively?
Options:
(A) {S→FR}, {R→ε}
(B) {S→FR}, empty
(C) {S→FR}, {R→*S}
(D) {F→id}, {R→ε}](../../assets/questions/CS-2006-Q58-1.webp)
![Question 58, GATE 2006: For grammar S→FR, R→*S|ε, F→id, what are predictive-table entries M[S,id] and M[R,$], respectively?
Options:
(A) {S→FR}, {R→ε}
(B) {S→FR}, empty
(C) {S→FR}, {R→*S}
(D) {F→id}, {R→ε}](../../assets/questions/CS-2006-Q58-2.webp)
Your answer
Answer & solution
Answer: A (no official key was published)
Step through it (2 parts)
1. For S→FR, R→*S|ε, F→id, FIRST(FR)={id}; hence M[S,id]={S→FR}. Since S is the start symbol and R occurs at the end of S→FR, $ belongs to FOLLOW(R).
2. Therefore M[R,$]={R→ε}. Option A.
3. Teaching check: An LL(1) table uses FIRST of a nonempty production; ε productions use FOLLOW of their left-hand side. Since id begins FR, the S/id cell receives S→FR. Since R can end the start-symbol derivation, end marker $ belongs to FOLLOW(R).