retagged by
3,628 views
2 votes
2 votes
Consider the following grammar

$S\rightarrow Aa\mid B $

$B\rightarrow a\mid BC$

$C \rightarrow a\mid \in$

the no of productions in simplified cfg is
retagged by

6 Answers

Best answer
4 votes
4 votes
1.Removal of null production

S->Aa|B
B->a|B|BC
C->a

2.Removal of Unit production
S->Aa|a|BC
B->a|BC
C->a

3.Removal of useless production

S->a|BC
B->a|BC
C->a
so total 5 production in simplified CFG.
selected by
4 votes
4 votes

We can remove Aa as A is not defined.
S->B
B-->a|bC
C-->a|eps


now, S->B is unit production
S-->a|bC
C-->a|eps


removing epsilon production,
S-->a|b|bC
C-->a


So, simplified CFG contains 4 productions.

4 votes
4 votes
It's 4.. firstly epsilon is removed from C.. making C->a and B->a|b|bC and den unit production S->B is replaced by production of B making S->a|b|bC and also Aa is removed from S coz of useless symbol.. so total production will be

S->a|b|bC

C->a

That's 4...

Related questions

712
views
1 answers
0 votes
301
views
1 answers
1 votes
5.8k
views
1 answers
1 votes
8.8k
views
1 answers
5 votes
sh!va asked Jun 21, 2016
8,824 views
Which of the following features cannot be captured by CFGSyntax of if then else statementsSyntax of recursive proceduresWhether a variable is declared before its useMatch...