1,276 views

1 Answer

1 votes
1 votes
Given Grammar is:

$S\rightarrow AB/CA$

$A\rightarrow a$

$B\rightarrow BC/AB$

$C\rightarrow aB/b$

Now we can see that $B\rightarrow BC/AB$ cannot reach a terminal as it end or starts with B itself. So, the production of B can be removed.

Now. the grammar becomes:

$S\rightarrow AB/CA$

$A\rightarrow a$

$C\rightarrow aB/b$

Now all the productions involving B can be removed.

Hence, finally, the grammar becomes

$S\rightarrow CA$

$A\rightarrow a$

$C\rightarrow b$

Related questions

0 votes
0 votes
0 answers
2