retagged by
6,685 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 \}$
retagged by

7 Answers

Best answer
23 votes
23 votes

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.

6 votes
6 votes
  First Follow
P {x} {$}
Q {y,z} {w,y}
R {w,ε} {y}
S {y} {$}

Ans: (C) - {w,y}

Answer:

Related questions

25 votes
25 votes
7 answers
2
khushtak asked Feb 14, 2017
6,940 views
Consider the following table:$$\begin{array}{|l|}\hline \textbf {Algorithms} & \textbf{Design Paradigms } & \\\hline \text{P. Kruskal} & \text{i. Divide and Conquer} \...
29 votes
29 votes
8 answers
3
20 votes
20 votes
8 answers
4
Arjun asked Feb 14, 2017
8,615 views
The probability that a $k$-digit number does NOT contain the digits $0, 5,$ or $9$ is$0.3^{k}$$0.6^{k}$$0.7^{k}$$0.9^{k}$