I'm supposed to construct a context-free grammar generating all strings in :

{(ab)$^{m}$c$^{n}$(ba)$^{m}$ : m, n, ≥ 0}

So far I have V = {A, S, a, b, c}, Σ = {a, b, c}, and R = (1) S -> A (2) S -> abSba (3) A -> cA and (4) A -> e

but I'm not sure what to do for the starting state, S. Also, I'm not sure if V should actually be {A, S, ab, ba, c} because the a's and b's always appear as ab or ba.

  • $\begingroup$ Welcome to COMPUTER SCIENCE @SE. What is your question? What is your problem with $S$? $\endgroup$
    – greybeard
    Oct 3 '20 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.