1

construct a grammar $G$ such that $L(G)=\{x^ny^mx^my^n/m,n>1\}$?

I don't have much idea how to approach this one. Could some help me to understand how to approach these kinds of problem?

frabala
  • 3,732

1 Answers1

1

Maybe start with $S\to xSy$ to get the equal number of $x,y$ on the outside, then $S \to T$ to shift into the inner $y^mx^m$, then $T \to yTx$ to finish them and a final $T \to \lambda$ to finish off the word.

coffeemath
  • 29,884
  • 2
  • 31
  • 52