search
Log In
3 votes
623 views
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
in Compiler Design
edited by
623 views

1 Answer

4 votes
 
Best answer
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
0
Why you have removed S -> Aa

 A is variable here??
0
But you can't reachA from S therefore we removed it
0
Do we remove, A because its definition is not present in the grammar??
0
plz give me proper explanation why A is not removed in that grammer

Related questions

3 votes
2 answers
1
620 views
in this question given ans is 9 s->Aa | a | bC | b B->a | bC | b C -> a but here B is unreachable ans has to 5 clarify plz.....
asked Dec 4, 2015 in Compiler Design tiger 620 views
2 votes
2 answers
2
1.1k views
Which of the following features cannot be captured by CFG? Syntax of if - then – else statements Whether a variable is declared before its use Syntax of recursive procedures Matching nested parenthesis pls explain about first option.how is it CFG possible??
asked Dec 8, 2016 in Theory of Computation Akriti sood 1.1k views
2 votes
1 answer
3
2.3k views
Which of the following features cannot be captured by CFG Syntax of if then else statements Syntax of recursive procedures Whether a variable is declared before its use Matching nested parenthesis
asked Jun 21, 2016 in Compiler Design sh!va 2.3k views
7 votes
2 answers
4
1.2k views
A context free grammar can be used to model the lexical concerns of a HLL. This is not normally done and a regular grammar is used for the structure of lexemes because (A) The cfg will blow up unnecessarily (B) The structure of lexemes can be described by the simpler regular grammar (C) There is a separation of concerns which controls complexity. (D) All of the above
asked Nov 22, 2015 in Compiler Design shikharV 1.2k views
...