Practice free →
HomeGATE CSEcomputerscienceCompiler Design › The FOLLOW(A) set in LL parsing is

The FOLLOW(A) set in LL parsing is

Aterminals that can follow A in some derivation
Bthe set of non-terminals A can derive to
Cthe set of A's predecessors
Dalways FIRST(A)
Answer & Solution
Correct answer: A. terminals that can follow A in some derivation
1. FOLLOW(A) = the set of TERMINALS that can appear DIRECTLY AFTER A in some valid derivation. 2. Formally: $a \in \text{FOLLOW}(A)$ iff $S \Rightarrow^* \alpha A a \beta$ for some $\alpha, \beta$. 3. The end-of-input marker `$` is always in FOLLOW(S) (where S is the start symbol). 4. USE: when a production rule $A \to \alpha$ has $\varepsilon \in \text{FIRST}(\alpha)$, the rule is applicable when the lookahead is in FOLLOW(A). 5. FOLLOW sets handle the $\varepsilon$-productions in LL(1) parsing tables. 6. Other options confuse FIRST or other sets. _Source: Bob Nystrom, "Crafting Interpreters", Ch 6 — referenced + classical compiler theory._
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions