in Compiler Design edited by
1,599 views
3 votes
3 votes

I think the answer should be option: C but it is given option A.

Providing the snapshot of the question with the options provided.

I don't think option A should be the correct one, even if it then we cannot derive string "bda" from option A which is possible in the original grammar.

Please help with this question.

Thanks in advance.

in Compiler Design edited by
1.6k views

4 Comments

none of the option is correct. i am really frustrated by seeing so many wrong questions in madeeasy test series.
1
1
agreed
0
0
"ca" is not being generated by option C but the actual grammer generates it
1
1

5 Answers

0 votes
0 votes
Ans is

S->Ab|b

A-> A' |bdA'

A'->cA' |adA' |null

Ans D is correct
0 votes
0 votes
S -> Aa/b

A -> Ac/Aad/bd/epsilon

there is left recursion for A production so remove it

A -> bdA'/A'       ------------ here A' for epsilon production as A ->epsilon  from the given production

A' -> cA'/adA'/epsilon

hence option (a) is correct

1 comment

Option (A) is wrong here, it should be $A’\rightarrow bdA’/A’$

None of the given options is correct.
0
0
0 votes
0 votes
Your answer is correct,

The solution provided is wrong.

In the original grammar, we can generate $bda$

by using $S \rightarrow Aa$ and $A \rightarrow bd$, which will give bda

however, in the solution grammar provided, there is no way to generate $bda$

as there is no way to get $A \rightarrow bd$.
0 votes
0 votes

option B is correct 

option A can’t generate  bda

option C cant generate  cca