-
Consider the following grammar:
What is FOLLOW(Q) ?
-
- {R}
- {w}
- {w, y}
- {w, $}
- {R}
Correct Option: C
Follow (Q) ?
Follow (Q) is First (R) Hence First (R) = {W, E}.
We add ‘W’ in Follow (Q) and for ∑.
We calculate :
First (S) = {y}
So, follow (Q) = First (R S)
= {{W} – ∑} ∪ First (S)
Follow (Q) = {W, y} ( ∴ First (S) = {y} )
Hence option (c) is correct.