edited by
2,251 views
4 votes
4 votes

how many Synthesized attributes are present in the given Syntax directed Definition?

(Answer key says only 2 Synthesized attributes are present. How to find them? Any idea?)

edited by

2 Answers

Best answer
3 votes
3 votes

It has 4 synthesized attribute which are 

E has the synthesized attributed  E.val and T the synthesized attribute  T.val

and F has the synthesized attribute F.val and digit has the synthesized attribute digit . lexval which is applied by the lexical analyzer .

Also , only semantic rule with side effect is  print(E.val) .

Refer ===>

http://www.csd.uwo.ca/~moreno//CS447/Lectures/Translation.html/node1.html

http://dragonbook.stanford.edu/lecture-notes/Columbia-COMS-W4115/08-03-24.html

www.cse.iitm.ac.in/~krishna/cs3300/lecture4.pdf

    selected by
    0 votes
    0 votes
    I think it is 7.

    As Synthesized attribute is used by parent node which takes value from its child. In given semantic rules if you see everytime when right hand side of production is reduced to  nonterminal there is some semantic action which has ti performed at everynode. Each parent is using value from its child.

    Plz Correct me if i am wrong.

    Related questions

    4 votes
    4 votes
    2 answers
    1
    0 votes
    0 votes
    2 answers
    2
    Subhadeeppathak asked Nov 28, 2022
    419 views
    Attributes are said to be of two type, synthesised and inherited. What actually is an attribute? Why an attribute exist, how to define it?
    1 votes
    1 votes
    2 answers
    3
    shekhar chauhan asked Jun 5, 2016
    978 views
    Either L attribute or S attributed .What kind of SDT it is ?S ->E# Out('#')E - E+E Out('+')E ->TT - T#F Out('*)T - FF - (E)F - a Out ('a')For the sentence...
    0 votes
    0 votes
    0 answers
    4