So i'm taking this class automata and complexity at georgia tech and we were given practice material for our exam.

one of the question is to give context free grammar for these two languages

enter image description here

enter image description here

and the answers are:


enter image description here


enter image description here

I can understand these and verify that these are indeed correct once I know the solution, but I'm finding it incredibly hard to even come close to coming up with them.

Does anyone have any advice on how to intuitively come up with CFGs

  • $\begingroup$ cs.stackexchange.com/q/18524/755 $\endgroup$
    – D.W.
    Commented Mar 26, 2023 at 18:54
  • $\begingroup$ thank you, this is helpful! :) $\endgroup$
    – SkV
    Commented Mar 26, 2023 at 19:10


Your Answer

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