i am trying to understand Context free grammar and generate a CFG for any given language.
when you're given a language , what is the best way to generate a CFG from it? are there any steps to follow to help you create a CFG for any language? is there ways of breaking down the language to make it simpler so that it helps you generate the CFG.
for example if i was given L={a^n (ba)^m a^n | n,m >=0 }
does that mean i need to have equal number of a's on both side, and have zero or more ba in between the a's ?
S---> aSa |ε
X---> baX |ε
any helps is appreciated.
X ----> baX | ε – chelseablue Dec 18 '18 at 00:07