# DAG COMPILER

6 votes
1.2k views A) 2

B)3

C) 4

D) 5

2
3 Internal node and 1 leaf node

## 1 Answer

15 votes

Best answer

The idea of making DAG of a given expression is to construct corresponding syntax tree first and then we find the common occurence in the tree and join these common occurence to their common parent ; indicating that the same units are not taken repeatedly..This is shown as follow : Hence number of internal nodes  =  3

Number of leaf node   =   1

Number of edges in DAG  =   6

selected by
0
wow sir such a good question and Great answer

## Related questions

0 votes
0 answers
1
305 views
Is DAG from compiler design is in the syllabus?
5 votes
0 answers
2
583 views
Consider C program given below main() { a=a+b; c=a*c; d=c-d; a=c/d; printf("%d",a); } What will the minimum number of nodes and edge present in the DAG representation of the output of above C program?
1 vote
2 answers
3
738 views
Consider the following code segment. x = u – t; y = x * v; x = y + w; y = t – z; y = x * y;
4 votes
1 answer
4
1.3k views
How to find unnecessary production while optimising DAG. for ex- a = b * c d = b e = d * c b = e f = b + c g = f + d How many production need to be removed and how to find them . ?