prashant sir t1=y+z

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+14 votes

Consider the syntax directed definition shown below.

$S \rightarrow \mathbf{ id :=} E$ | $\{gen(\mathbf{ id}.place = E.place;);\}$ |

$E \rightarrow E_1 + E_2$ | $\{t = newtemp();$ |

$gen(t = E_1.place + E_2.place;);$ | |

$E.place = t;\}$ | |

$E \rightarrow id$ | $\{E.place = \mathbf{id}.place;\}$ |

Here, $gen$ is a function that generates the output code, and $newtemp$ is a function that returns the name of a new temporary variable on every call. Assume that *t _{i}*'s are the temporary variable names generated by $newtemp$. For the statement ‘$X : = Y + Z$’, the $3$-address code sequence generated by this definition is

- $X = Y + Z$
- $t_1 = Y+Z; X=t_1$
- $t_1 =Y; t_2=t_1 +Z; X=t_2$
- $t_1 =Y; t_2=Z; t_3=t_1+t_2; X=t_3$

+11 votes

- All categories
- General Aptitude 1.4k
- Engineering Mathematics 5.9k
- Digital Logic 2.3k
- Programming & DS 4.2k
- Algorithms 3.6k
- Theory of Computation 4.6k
- Compiler Design 1.7k
- Databases 3.3k
- CO & Architecture 2.9k
- Computer Networks 3.3k
- Non GATE 1.2k
- Others 1.3k
- Admissions 506
- Exam Queries 480
- Tier 1 Placement Questions 22
- Job Queries 64
- Projects 15

40,748 questions

47,471 answers

145,586 comments

62,234 users