1 1 vote Consider the following translation rules: \[ \begin{array}{l} \mathrm{S} \rightarrow \mathrm{~A} \quad\{\mathrm{~A} . \text { val }=0\} \\ \mathrm{A} \rightarrow \mathrm{~A}_{1} 1 \quad\left\{\mathrm{~A} \cdot \text { val }=\mathrm{A}_{1} \cdot \text { val }+1\right\} \\ \mathrm{A} \rightarrow \mathrm{~A}_{1} 0 \quad\left\{\mathrm{~A} . \operatorname{val}=\mathrm{A}_{1} \cdot \text { val }\right\} \\ \mathrm{A} \rightarrow \mathrm{~B} \quad\{\text { print }(\mathrm{A} . \text { val })\} \end{array} \] The number of inherited attributes are 0 1 2 3 Compiler Design compiler-design syntax-directed-translation test-series + – KISHALAY DAS 1.6k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
2 2 votes i think 0 none of the SDTs is deriving values from his siblings..only parent is derving from children....so no inherited attributes are present here sudsho answered Nov 14, 2016 sudsho comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments Prashant. commented Nov 14, 2016 reply Follow flag 1st of all what this grammer do is no undersdtandable. 2nd at S -> A. how A.val = 0 updated . they take it as inherited attribute may be.. 0 0 replyShare sudsho commented Nov 14, 2016 reply Follow flag i dont think A.val=0 is an inherited attribute... attribute which takes values form parents or sibling nodes are called inherited attributes only so none of these properties is satisfied by val here....correct me if wrong 0 0 replyShare Prashant. commented Nov 14, 2016 reply Follow flag m not saying it is inherited . i think they considered as inherited. Gramar what produce is not understable. they put anything 0 0 replyShare Please log in or register to add a comment.