2.2k views

Consider the following grammar:

• $P\rightarrow xQRS$
• $Q\rightarrow yz\mid z$
• $R\rightarrow w\mid \varepsilon$
• $S\rightarrow y$

What is FOLLOW($Q$)?

1. $\left \{ R \right \}$
2. $\left \{ w \right \}$
3. $\left \{ w,y \right \}$
4. $\left \{ w,\$ \right \}$edited | 2.2k views ## 7 Answers +19 votes Best answer Follow of$Q$is first of$R$so we get$\{w\}$but since$R$can be Null so we have to check first of$S$which is$\{y\}$so FOLLOW$Q=\{w,y\}$Correct option (C) by Active (3.4k points) edited by +8 votes correct option is c. by Loyal (8k points) +1 could u plz tell me how to insert a picture in this 0 Nice explanation. From this answer Follow set find rules can be verified. +5 votes  First Follow P {x} {$} Q {y,z} {w,y} R {w,ε} {y} S {y} {\$}

Ans: (C) - {w,y}

by Junior (517 points) so C is ans.

by Loyal (6.8k points)
–1 vote
c is correct
by Active (4k points)
–1 vote
Ans option d
by (419 points)
0
answer d is not correct because for Follow of Q we have to find first of R and there is epsilon move in first of R so by putting epsilon in P now we have to find first of S hence option C
0