in Compiler Design edited by
3,329 views
1 vote
1 vote

Q). Consider the following directed acyclic graph (DAG):

         

                

The expression represented by above DAG is:

(A)  $a+a+(a+a+a)$

(B)  $a+a+(a+a+a+(a+a+a+a))$

(C)  $a+a+(a+a+a+(a+a+a))$

(D) None

in Compiler Design edited by
3.3k views

4 Answers

5 votes
5 votes
In this question better u go bottom - up  so here       1.    (a+a)

                                                                                  2.  ((a+a)+a)

                                                                                  3.  (((a+a) +a) + a)

 so here option D is correct

3 Comments

D right?? Sure na?
0
0
yes ...option D
0
0
Okay bro. I was not expecting errors from Virtual Gate. Thats why I am double checking.
0
0
2 votes
2 votes

operator + is left associative.the expression has to be left asssociative.but the resulting grammar may be left of right recursive.

and  answer has 4  a's in the expression

4 Comments

So D is the answer
0
0
yup
1
1
Is it   ((a+a)+a)+a)  ...the answer ?
1
1

Abhijit Borah 

I think, you are right.

0
0
0 votes
0 votes
Answer is D.
0 votes
0 votes
The right answaer of this question is option B
by