GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 2(xiii)

FOLLOW sets with damaged option names

Compiler Design · Parsing & Syntax Analysis · Full GATE CSE 1992 paper

GATE 1992, Q2(xiii) MSQ
Report issue

Parsing & Syntax Analysis

Question 2(xiii), GATE 1992: FOLLOW(A) uses arbitrary sentential forms; LFOLLOW/RFOLLOW restrict to leftmost/rightmost forms. Both sources lose the L/R prefixes in choices A/B. Determine valid semantic relationships.
Question 2(xiii), GATE 1992: FOLLOW(A) uses arbitrary sentential forms; LFOLLOW/RFOLLOW restrict to leftmost/rightmost forms. Both sources lose the L/R prefixes in choices A/B. Determine valid semantic relationships.
Tap to enlarge
Select all that apply
Answer & solution

Answer: Option letters unresolved; LFOLLOW may differ, and RFOLLOW=FOLLOW under a productive-grammar convention (no official key was published)

Restricted derivations yield subsets of the ordinary FOLLOW set. For S→AB, A→a, B→b, ordinary and rightmost derivations expose Ab, so b belongs to FOLLOW(A) and RFOLLOW(A). Leftmost derivations must expand A before B, so LFOLLOW(A) is empty. This refutes the choices asserting all three always identical or all three always different. For productive grammars, rightmost derivations can realize the needed right context, giving RFOLLOW=FOLLOW. Without that convention, S→XB, X→Ab, B→B gives FOLLOW(A) containing b but no rightmost occurrence of A. Since A/B repeat the unqualified name FOLLOW in both copies, their intended exact comparisons and letters are not reconstructed silently.

Original paper, page 3