edited by
10,885 views
27 votes
27 votes

Consider the CFG with $\left\{S, A, B\right\}$ as the non-terminal alphabet, $\{a, b\}$ as the terminal alphabet, $S$ as the start symbol and the following set of production rules:

$S \rightarrow aB$            $S \rightarrow bA$

$B \rightarrow b$               $A \rightarrow a$ 

$B \rightarrow bS$           $A \rightarrow aS$

$B \rightarrow aBB$       $S \rightarrow bAA$

Which of the following strings is generated by the grammar?

  1. $aaaabb$
  2. $aabbbb$
  3. $aabbab$
  4. $abbbba$
edited by

2 Answers

Best answer
35 votes
35 votes
$S  \rightarrow aB$
    $ \rightarrow aaBB$
    $ \rightarrow aabB$
    $ \rightarrow aabbS$
    $ \rightarrow aabbaB$
    $ \rightarrow aabbab$

Correct Answer: $C$
edited by
0 votes
0 votes
ans c) b)
Answer:

Related questions

75 votes
75 votes
8 answers
2
Kathleen asked Sep 21, 2014
35,373 views
Consider the following two statements:P: Every regular grammar is LL(1)Q: Every regular set has a LR(1) grammarWhich of the following is TRUE?Both P and Q are trueP is tr...
15 votes
15 votes
3 answers
4
Kathleen asked Sep 21, 2014
9,573 views
Which one of the following is a top-down parser?Recursive descent parser.Operator precedence parser.An LR(k) parser.An LALR(k) parser.