0
$\begingroup$

Let $\Sigma = \{a, b\}$. For each of the following languages, find a grammar that generates it.

(a) $L_1 = \{a^n b^m : n\geq 0, m>n\}$

(b) $L_1^3$

(C) $L_1^*$

I know the grammar for the language $L_1$, that is

$S \rightarrow aSb \mid bA$
$A \rightarrow bA \mid \epsilon$

please help me to find the grammars for another two languages.

$\endgroup$
1
  • $\begingroup$ Please ask only one question per post! As for b,c: What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for tips on asking questions about exercise problems. If you are uncertain how to improve your question, why not ask around in Computer Science Chat? $\endgroup$
    – Raphael
    Commented Aug 31, 2017 at 22:50

1 Answer 1

0
$\begingroup$

b) Introduce a new start symbol $S_1$ and a new production rule $S_1 \rightarrow SSS$

c) Introduce a new start symbol $S_2$ and a new production rule $S_2 \rightarrow S_2S \mid \epsilon$

$\endgroup$
4
  • $\begingroup$ Can I write $L1^3$ as $L1^3$ = {$a^nb^m a^p b^q a^r b^s : n, p, r >=0, m>n, q>p, s>r$} ? how to write L1*? $\endgroup$ Commented Aug 31, 2017 at 21:29
  • $\begingroup$ @ManuThakur yes you can. $\endgroup$
    – fade2black
    Commented Aug 31, 2017 at 21:35
  • $\begingroup$ please tell me how to write L1*? $\endgroup$ Commented Aug 31, 2017 at 21:35
  • $\begingroup$ Just Kleene closure of $L_1$ $\endgroup$
    – fade2black
    Commented Sep 1, 2017 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.