syntax directed translation : GATE 1995

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 "3" }

S = start state

what is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules?

a) 23131

b) 11233

c) 11231

d) 33211


Answer:  a) 23131