Similar questions 2 more →
Semantic Analysis & Type Checking

Your answer
Answer & solution
Answer: A: 23131 (no official key was published)
Step through it (14 steps)
The innermost y reduces to S first, printing 2. That S followed by z reduces to W, printing 3. The preceding xx and this W reduce to S, printing 1. The remaining outer z then permits W→Sz, printing another 3, and the remaining outer xxW reduces to S, printing the last 1. Thus the output is 23131. Actions occur after reductions, giving inside-out order rather than the order of productions in a top-down derivation.