edited by
21,714 views
74 votes
74 votes

Consider the following context-free grammar over the alphabet $\Sigma = \{a,b,c\}$ with $S$ as the start symbol:$$S \rightarrow abScT \mid abcT$$$$T \rightarrow bT  \mid b$$Which one of the following represents the language generated by the above grammar?

  1. $\{\left ( ab \right )^{n}\left ( cb \right )^{n} \mid n \geq 1 \}$
  2. $\{\left ( ab \right )^{n}cb^{m_{1}}cb^{m_{2}}...cb^{m_{n}} \mid n, m_{1}, m_{2}, ..., m_{n} \geq 1 \}$
  3. $\{\left ( ab \right )^{n}\left ( cb^{m} \right )^{n} \mid m,n \geq 1 \}$
  4. $\{\left ( ab \right )^{n}\left ( cb^{n} \right )^{m} \mid m,n \geq 1 \}$
edited by

8 Answers

0 votes
0 votes

T→ bT | b, this production will generate any number of b’s > 1
S→ abScT | abcT, this production will generate equal number of “ab” and “c” and for every “abc” any number of b’s ( > 1) after “abc”.
For Ex:

Hence the language generated by the grammar is
L = {(ab)n cb(m1 ) cb(m2 )…cb(mn )│n,m1,m2,…,mn ≥ 1}

0 votes
0 votes
B is answer.

Option A, C and D all can generate the strings where may have 2 occurrences of C but given grammar has a restriction on this, c B c B..
0 votes
0 votes

Just expand the tree and derive the string. Option B is the best expression for the language.

Answer:

Related questions

44 votes
44 votes
6 answers
3
Arjun asked Feb 14, 2017
11,599 views
If $G$ is a grammar with productions$S\rightarrow SaS\mid aSb\mid bSa\mid SS\mid\epsilon$where $S$ is the start variable, then which one of the following strings is not g...