Question: Give a pushdown automaton that accepts strings in the alphabet ? = { a , b , ), (} such that the parentheses are correctly
Give a pushdown automaton that accepts strings in the alphabet ? = {a, b, ), (} such that the parentheses are correctly matched, and between each left parenthesis and the next right parenthesis, and in the whole string, there are equal numbers of as and bs.
For example, ((abab)(ab)) is accepted but ((aab(ab)) is not accepted. Also ((abab)ab(ab)) is accepted, but not ((abab)aba(ab)). The stated conditions guarantee that, as you proceed from left to right, each time you encounter either kind of parenthesis, the numbers of as and bs already processed are equal. Explain how ((abab)ab(ab)) is accepted by your PDA, and ((abab)aba(ab)) is not.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
