0

I'm studying formal languages and automata, and on the section of learning how to find productions that generates the grammar, I've done some exercises pretty well and was able to do some of the exercises on the format:

$L(G_1) = \{wcw^r / w\, is\, on\, \{0,1\}^*\}$

Where $w^r$ is the reverse word, and whose productions are:

$S \rightarrow c\, / \,0S0\,/\, 1S1$

But I'm struggling to find CSG of the following language (maybe a difficult one?):

$L(G_1) = \{ww / w\, is\, a\, word\, from\, \{a,b\}^*\}$

Almost every type of production that I tried ended up generating $ww^r$ instead of $ww$ such as:

$S \rightarrow aAa\,/\,bAb$

$A \rightarrow S\,/\, \epsilon$

Is there some kind of production that I'm not considering?

John L.
  • 39,205
  • 4
  • 34
  • 93

1 Answers1

0

What little you write here suggests you are trying to find a context-free grammar for the language you are having difficulty with. As it happens, that language is NOT context-free, i.e no such grammar is possible for that language. If you are aware of context-sensitive grammars, I suggest you try to find one for that language.

PMar
  • 1