The Gateway to Computer Science Excellence
+1 vote
100 views

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 Active (1.3k points) | 100 views
0
Is it 6 ??
0
i'm also getting 6?
0
t1=b*c;

t2=a+t1;

t3=t2+d;

t4=t3-e;

t5=t4-t2;

im getting 5 ...
0
Look at that line "-" is left associative so you have to do d-e and then there result -a and then remaining things.
0

yeah same as  Anjan 

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

+1
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 * > + > -

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,365 answers
198,495 comments
105,263 users