1

The best way is to learn is to look at examples, and see how they work. One of the simplest "real" context-free languages is $\{\; a^mb^n \mid n = m \;\}$ Its grammar is $S\to aSb\mid \varepsilon$. Now add in steps, the extra 3, and the more than ... $\{\; a^mb^n \mid n = m+3 \;\}$ $\{\; a^mb^n \mid n \le m+3 \;\}$


1

The unequal number of $a$'s and $b$'s have {equal number of $a$'s and $b$'s} with {{extra $a$'s } or {extra $b$'s}} Extra $a$'s or extra $b$'s can be at the beginning at the end in between (ANY WHERE) and any number of times Let $P$ derive strings with extra $a$'s Let $Q$ derive strings with extra $b$'s Let $X$ derive equal number of $a$'s and $b$'s Let $A$...


Only top voted, non community-wiki answers of a minimum length are eligible