in Compiler Design retagged by
6,716 views
20 votes
20 votes

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 \}$
in Compiler Design retagged by
by
6.7k views

7 Answers

23 votes
23 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)

edited by
9 votes
9 votes

correct option is c.

3 Comments

could u plz tell me how to insert a picture in this
1
1
Nice explanation. From this answer Follow set find rules can be verified.
0
0
Nice Explanation :)
0
0
6 votes
6 votes
  First Follow
P {x} {$}
Q {y,z} {w,y}
R {w,ε} {y}
S {y} {$}

Ans: (C) - {w,y}

5 votes
5 votes

so C is ans.

by
Answer:

Related questions