in Compiler Design edited by
765 views
2 votes
2 votes

Which attributes in the following grammar are synthesized?

  1. A.a
  2. B.b
  3. B.x
  4. C.c
in Compiler Design edited by
765 views

6 Comments

B-Cannot be the answer it's visible the B.b is taking it's values from a which is part of its left ancestor
16
16

@Sachin Mittal 1 sir please look in to this

0
0

Definition provided in Ullman:

A synthesized attribute for a nonterminal A at a parse-tree node N is defined by a semantic rule associated with the production at N. Note that the production must have A as its head. A synthesized attribute at node N is defined only in terms of attribute values at the children of N and at N itself.

0
0

@Sachin Mittal 1 sir, .As a child's attributes can only be dependent on inherited attributes of the parent, B.b can not be synthesized, as C.c is taking values from B.b so B.b can not be synthesized, this can also be a reason?
 

0
0
yes obviously if option D is not the answer then B also should not be the one.
0
0

1 Answer

0 votes
0 votes
Why "c" can't be an answer?

1 comment

because C.c is synthesizing by its left siblings and again it synthesizes to its parent C.x which is correct synthesized. here C.x is answer not C.c
0
0
Answer:

Related questions