Compiler Design

1:

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

S----> xxW ( PRINT "1")

S----> y { print " 2 " }

S----> Sz { print " 3 " )

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

Explanation :

Mrugesh said: (8:27pm on Monday 23rd September 2013)
Given answer is correct but rule 3) S----> Sz { print " 3 " ) is wrong it should be3) W----> Sz { print " 3 " )
Dinesh said: (1:13pm on Wednesday 14th October 2015)
rule first is S->xxS so s->Sz----3 ->Szz---3 ->xxSzz--1 ->xxxxSzz--1 ->xxxxyzz--2answer must be 33112
kajal Bhandare said: (8:33pm on Friday 11th May 2018)
Given answer is correct 23131 s->xxw w->szs->xxww->szs->ythe answer will be 23131

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.