edited by
1,084 views
2 votes
2 votes

Consider the following productions along with their semantic rules

Here ⋅ i and ⋅ s corresponds to inherited and synthesized attributes respectively. The value for expression 3 ∗ 4 __________.

edited by

2 Answers

1 votes
1 votes
Is the answer 11<-   3+2*4=11
0 votes
0 votes

$T\rightarrow$ $F(id\rightarrow {\textbf{3}})$ $T'({\textbf{*}}$$F(id\rightarrow{\textbf{4}})$ $T_{1}(T_{1}\rightarrow\epsilon))$


  • $It \ will \ make \ 1_{st} \ Fval=3 \ and \ therefore \ the \ inherited \\ T' \ will \ get  \ 3 \  as \ value  \ assigned \ to \ it.$
  • $Now \ the \ parent  \ T \ which \  is \ root \ of  \ this \ SDT \ will \  get  \ value \  from \  the\ last \\ T'\ which \ is \ evaluated \ and \ therefore \ root \ will \ get \ 3 \ as \ final \ value .$
  • $ \\Other \ Translations  \ are \  not \  working \  in  \ this \ SDT$
     

Related questions

1 votes
1 votes
1 answer
2
worst_engineer asked Jan 5, 2016
893 views
The way I solved it was :is this correct evaluation order ?Because in the answer they have mentioned different order :
1 votes
1 votes
1 answer
3