A shift-reduce parser carries out the actions specified within braces…

A shift-reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of the grammar.

S → x x W  [print “1”]
S → y      [print “2”]
W → S z    [print “3”]

What is the translation of “x x x x y z z”?

  1. A.

    1 1 2 3 1

  2. B.

    1 1 2 3 3

  3. C.

    2 3 1 3 1

  4. D.

    2 3 3 2 1

Attempted by 33 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…