search
Log In
1 vote
223 views
Construct the DAG for the expression
$((x + y)-((x + y)\ast(x -y))) + ((x+y)\ast(x-y))$
in Compiler Design 223 views

2 Answers

1 vote

((x+y)−((x+y)∗(x−y))) and ((x+y)∗(x−y)) expression needed to be added together at the end. So according to me, DAG should be following...

 

0 votes

DAG for the expression ((x+y)−((x+y)∗(x−y)))+((x+y)∗(x−y))

 

2
I think you missed this part "minus from the Top should be connected to multiply" because of this condition ((x+y)−((x+y)∗(x−y)))

Related questions

0 votes
0 answers
1
208 views
Construct the DAG and identify the value numbers for the subexpressions of the following expressions, assuming $+$ associates from the left. $a+b+(a+b)$ $a+b+a+b$ $a+a+((a+a+a+(a+a+a+a))$
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 208 views
0 votes
0 answers
2
100 views
Assuming that function $widen$ in Fig. $6.26$ can handle any of the types in the hierarchy of Fig. $6.25(a)$, translate the expressions below. Assume that c and d are characters, $s$ and $t$ are short integers, $i$ and $j$ are integers, and $x$ is a float. $x=s+c$ $i=s+c$ $x=(s+c)\ast(t+d)$
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 100 views
0 votes
0 answers
3
0 votes
0 answers
4
...