I am trying to figure out how to do arithmetic expressions in Pushdown Automata ?(PDA) for example L=W|W=An Bm Cn-m What i am thinking of doing is to push As then pop Bs and then either pop As with C or Bs with C depending what is left. For example aaabbc (pushing aaa then popping with Bs bba and then either pop A with C or B with C depending which one is bigger.
Asked
Active
Viewed 966 times
1 Answers
0
For a word w
to be in the language, it has to have n>=m
by your definition (otherwise C^(n-m)
is negative, and that's impossible).
So, your automaton basically needs to:
- Push to stack when seeing 'a'
- pop from stack upon seeing 'b'
- pop from stack upon seeing 'c'.
Also, some important issues:
- You need to move between different states when seeing a 'new' character.
- Your automaton should accept
w=eps
(empty word). w=a^b b^n
is also in the language, make sure you take care of that.
I hope I gave you good enough leads to solve it on your own..
Good luck!

amit
- 175,853
- 27
- 231
- 333