in Compiler Design edited by
1,618 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

19 Comments

  1. S->Ab|b
  2. A-> A' |bdA'
  3. A'->cA' |adA' |null

d is correct.

0
0
why not c
0
0

A-> A'  is missing since original grammar generate a but option c is not generate.

0
0
ok...could you help me in this question https://gateoverflow.in/163697/self-doubt
0
0

shivi 

  1. A'->cA' |adA' |null should be there but it is given  A->cA' |adA' |null. so from where you use A'
0
0
Ya anu I  didn't notice that it was A not A'  my bad... thanks...
0
0
option A is wrong because second prod should be

A $\rightarrow$ bd${A}'$/${A}'$
3
3
Thanks @Mk Utkarsh so option C is the correct one right ?
0
0
it seems correct to me.
0
0
Option C shouldn't be the answer as well. In the third derivation ${A}'$ should be there on LHS and not A.
0
0

vishal chugh i'm not very good with this topic but help me pointing out any string that is not generated by C or any extra string by option C is generated as compared with given grammar

and i agree with you that's why i mentioned what's wrong with option A

0
0
edited by

Mk Utkarsh Its not a correct grammar only as ${A}'$ can't be evaluated. So I think they just did a typo in the LHS of last production. 

0
0
no opion is correct...because in c A' doesn't have terminalll....and

option a is not generating. ,....bda
0
0
yeah there is a typo in A option that's it
0
0
@vishal  I think the last production they made a type there, otherwise it would have been option C.

So, for this none of the production given in the option seems correct.

Thanks as I wanted to know how they have provided option A as the correct answer as its no way seems correct answer.

Thanks
0
0
Grammar after removing left recursion:

$S \rightarrow Aa|b$

$A \rightarrow bdA'|A'$

$A' \rightarrow cA'|adA'| \epsilon $

In option a) only error is $bA'$ in place of $bdA'$
0
0
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