• edited by
29 views
0 0 votes

What will be the "First" and "Follow" of $\mathrm{E}$ and $\mathrm{F}$ for the following grammar?

$\mathrm{E}->\mathrm{TE}{ }^{\prime}$
$\mathrm{E}^{\prime}->+\mathrm{TE}{ }^{\prime} / \varepsilon$
$\mathrm{T}->\mathrm{FT}^{\prime}$
$\mathrm{T}^{\prime}->^{*}\text{FT}{ }^{\prime} / \varepsilon$
$\mathrm{F}->\mathrm{id} /(\mathrm{E})$

  1. $\operatorname{First}(\mathrm{E})=\{\mathrm{id},(, \varepsilon\}, \operatorname{Follow}(\mathrm{E})=\{\varepsilon,)\}, \operatorname{First}(\mathrm{F})=\{\mathrm{id,}), \$\}, \operatorname{Follow}(\mathrm{F})=\{*, \$,( \}$
  2. $\operatorname{First}(\text{E})=\text{i d},( \}, \operatorname{Follow}(\text{E})=\{\$,)\}, \operatorname{First}(\text{F})=\text{i d},( \}, \operatorname{Follow}(\text{F})=\{*, \$,),+\}$
  3. $\operatorname{First}(\mathrm{E})=\{\mathrm{id,}), \varepsilon\}, \operatorname{Follow}(\mathrm{E})=\{\varepsilon,)\}, \operatorname{First}(\mathrm{F})=\{\mathrm{id},)\}, \operatorname{Follow}(\mathrm{F})=\{*, \mathrm{\$},(,+\}$
  4. $\operatorname{First}(\mathrm{E})=\{\mathrm{id,})\}, \operatorname{Follow}(\mathrm{E})=\{\$,)\}, \operatorname{First}(\mathrm{F})=\{\mathrm{id,}(, \$\}, \operatorname{Follow}(\mathrm{F})=\{*, \mathrm{\$},),+\}$

Please log in or register to answer this question.

Answer:
Position:
Show:

Related questions

0 0 votes
0 0 answers
45
45 views
Shubham Sharma 2 asked Jun 28
45 views
Which of the following statements is TRUE?The cardinality ratio for a binary relationship specifies the maximum number of relationship instances that an entity can partic...
0 0 votes
0 0 answers
34
34 views
Shubham Sharma 2 asked Jun 28
34 views
Which of the following represents the function of a Multiplexer?$\mathrm{Y}=\mathrm{A}+\mathrm{B}$$\mathrm{Y}=\mathrm{A} \mid \mathrm{B}$$\mathrm{Y}=\mathrm{A} ~\& ~\text...
0 0 votes
0 0 answers
31
31 views
Shubham Sharma 2 asked Jun 28
31 views
The prefix equivalent of the following infix expression is:$a / b-c+d^{*} e-a ^{*}c$$-+-/ a b a^{*} d e^{*} a c$$+ / a b c^{*} d e^{*} a c$$-+/ a b c-^{*} d e^{*} a c$$ +...
0 0 votes
0 0 answers
34
34 views
Shubham Sharma 2 asked Jun 28
34 views
Which of the following file-type arguments is used in fopen $()$ library function to open a new file for both reading and writing, and destroys the file if a file with th...