# What is Follow(X) when there's a rule, A -> XBCD where First(B) and First(C) contain empty, but First(D) do not

Suppose there's a rule,

A -> XBCD

B -> $\beta$ | $\epsilon$

C -> $\gamma$ | $\epsilon$

D -> $\delta$

What is Follow(X)?

Is it (First(B) - $\epsilon$) $\cup$ (First(C) - $\epsilon$) $\cup$ First(D) = {$\beta$ , $\gamma$, $\delta$ } ?

• $FOLLOW(X)$ is the set of symbols which might immediately follow $X$ in some derivation. FWIW, It's conventional to use Greek letters for sequences of symbols (with $\epsilon$ representing the empty sequence); based on that understanding, I would have said that $FOLLOW(X)$ is $FIRST(\beta)\cup FIRST(\gamma) \cup FIRST(\delta)$. But perhaps you mean those Greek letters to be terminals. – rici Jun 11 '18 at 6:33
• I've got it! Yeah, I used Greek letters as terminals, but I now understand that this is not usual. With this in mind, I read the book again, and finally I get it! As you say, they are using Greek letters as sequences of symbols. Thank you very much!! – toshi-san Jun 11 '18 at 13:58

If there is a production B-> $\alpha$ A $\gamma$, then First ($\gamma$) - {$\epsilon$} is in Follow (A)
BCD corresponds to $\gamma$ in the definition.