Syntax Analysis41

0. A shift-reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar
S → xxW{print"1"}
S → y {print"2"}
W → Sz{print"3M}
What is the translation of xxxxyzz using the syntax-directed translation scheme described by the above rules?

  • Option : A
  • Explanation :
    S → XXW{Print + 1}
    S → Y {Print + 2}
    W → SZ {Print + 3}
    Translation of XXXXYZZ
    S → XXW   1
    → XXSZ   3
    → XXXXWZ   1
    → XXXXSZZ   3
    → XXXXYZZ   2
    Syntax directed translation scheme described by 23131
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *