prashant sir t1=y+z

The Gateway to Computer Science Excellence

+19 votes

Consider the syntax directed definition shown below.$$\begin{array}{ll}

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

E \rightarrow E_1 + E_2 &\qquad \{t = newtemp();\\

&\qquad gen(t = E_1.place + E_2.place;);\\

&\qquad E.place = t;\}\\

E \rightarrow id&\qquad \{E.place = \mathbf{id}.place;\}

\end{array}$$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 *ti*'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$

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.4k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.4k
- Others 1.7k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,666 questions

56,167 answers

193,838 comments

94,004 users