in Compiler Design
508 views
1 vote
1 vote

The minimum number of temporary variables to convert it into SSA is _________.
a + b × c + d – e – a + b × c
Assume order of precedence from highest to lowest as: ×, + and –. Consider associativity for + and × are not important but – is left associative.

My ans : 5

in Compiler Design
by
508 views

4 Comments

yeah same as  Anjan 

0
0

I think left associative mean leftmost - is evaluated first. 

but not as "so you have to do d-e and then there result -a" 

please correct me if i'm wrong Ashwin Kulkarni

0
0
I am getting 5.

$t1 = b*c$

$t2 = a + t1$

$t3 = t2 + d$

$t4 = t3-e$

$t5 = t4 - t2$

Paranthesization of the expression is:- $((((a+(b*c)+d)-e)-(a+(b*c)))$

Precedence of Operator is * > + > -
1
1

Please log in or register to answer this question.