I have a problem where I am asked to explain why the language that has words made of $a$ and $b$ such that the number of $a$'s is equal to the number of $b$'s, can be generated by a context free grammar. I am not sure of what is asked here, will finding such a grammar work? What should I do?
Asked
Active
Viewed 52 times
1 Answers
0
Usually, to prove that some language is a CFL (which is equal as asking whether it is generated by some CFG) you can show:
- It is generated by some CFG. Proving is usually done by induction, where one direction is an induction on the number of derivation steps, and the other direction is usually an induction on the length of the word.
- Showing a PDA that accepts the language.
- Using closure properties of CFL, and generate the language from some finite number of CFL/regular languages using closure properties (like concatenation, union, etc..)
Mickey
- 573
- 4
- 14