# MadeEasy Test Series: Compiler Design - Intermediate Code

275 views
a x b x c + d - a + e x f - g + h
order of precedence : x>+>- ; with x is left associative and +, - as right.
Min number of variables required in TAC?
Should'nt the expression be expressed as :

((a x b) x c) + d - a + (e x f) - g + h
(((a x b) x c) + (d - (a + (e x f)) - (g + h)))

edited
0
Minimum number of variables required in Three address code?Is it your question
0
((((a x b) x c) + d) - ((a +( e x f) )- (g + h)))
0
Yes @manas please explain wht's wrong in what I am doing.

@shivam yes
1
@manisha11 while paranthising you forgot that + has higher precedence over - and you treated as if both have same precedence and are right to left associative.
0
yeah
THANKS!
0
We have different types of 3address code representations like triple, quadruple ,indirect in which does the result wanted to be in?

Indirect doesn't use any extra variables I guess.
0
@hemanth i think in gate they ask to represent in general form of 3 address code
0
Will someone tell me how many minimum number of variables will be used in this question? @hemanth

@manisha11

@manas mishra
0

Shivam Kasat

Got 15 as below.

manisha11 what is the answer they have provided?

0
8 temperory variables + a-h(8)

16 ! Isn't it?
0
no its 15--> 7 temp + a-h(8)
0
t1-t8(8)+a-h(8)=16
0
Yes sorry :P
0
:)
0

@Hemanth_13 The question is minimum number of variables required in three address code, does that mean SSA?

1
No SSA explicitly mention if they ask

see previous years 2015,16,17 questions
0
SSA is not mentioned..so 3 variables

It must be 16 temporary variable.

(T1 to T8) and (a to h )

Make sure it is 3 address code not SSA

so we can reuse temporary variable after using * > + > - precedence

* Left to right associative rest Right to Left

## Related questions

1 vote
1
373 views
Consider the intermediate code given below: The number of nodes and edges in the control-flow graph constructed for the above code, respectively are X and Y. The value of X + Y is ________.