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._
Related questions
The FIRST(α) set of a string α in LL parsing isAfter the parser produces an AST, the next compiler phase is typicallyA SHIFT/REDUCE CONFLICT in an LR parser occurs whenWhich of these is a BOTTOM-UP (LR) parser feature?An LL(1) grammar requires that, given the leftmost non-terminal and ONE token of lookaheadLL parsers (recursive descent) parse from thePANIC MODE error recovery in a parser works byWhat is a SYNTAX ERROR?