adplus-dvertising
frame-decoration

Question

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

S -> xxW[print“1”]
S -> y[print“2”]
W -> S2[print“3”], what is the translation of “x x x x y z z”?

a.

1 1 2 3 1

b.

1 1 2 3 3

c.

2 3 1 3 1

d.

2 3 3 2 1

Answer: (c).2 3 1 3 1

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. A shift-reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of the grammar. S -> xxW[print“1”] S ->...