0
$\begingroup$

I have a question about follow sets.

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$ } ?

$\endgroup$
  • $\begingroup$ $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. $\endgroup$ – rici Jun 11 '18 at 6:33
  • $\begingroup$ 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!! $\endgroup$ – toshi-san Jun 11 '18 at 13:58
0
$\begingroup$

I am answering my own question. As @rici made a comment, I misunderstood the meaning of Greek letters in the discussion of Follow sets in the book I am reading. Greek letters mean sequences of symbols.

Using the definition,

If there is a production B-> $\alpha$ A $\gamma$, then First ($\gamma$) - {$\epsilon$} is in Follow (A)

First(BCD) is in Follow(X) where

A -> XBCD

BCD corresponds to $\gamma$ in the definition.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.