Consider the grammar:
S → aSa | bSb | aa | bb
A shift-reduce parser works by identifying the handle of each right-sentential form and replacing it by the head of the corresponding production. In this question, we indicate the handle of a right-sentential form by surrounding it by square brackets [...]. Which of the following shows a right-sentential form of the above grammar with the handle properly marked?
|
|
a)
|
abab[aababa]
|
|
|
b)
|
ababaS[ababa]
|
|
|
c)
|
ababbS[bbaba]
|
|
|
d)
|
abab[bSb]baba
|