# Push down automata acceptance by Empty stack and final state

I have a very basic question. Can we have a PDA which can accept a string by both final states and empty stack? Can the same PDA accept by the two modes simultaneously ? If there are final states for acceptance and in addition to that at some point in time the input string is read completely and simultaneously the stack is empty but the state is non-final. Will it be accepted in that case ?

## migrated from stackoverflow.comDec 4 '16 at 13:33

This question came from our site for professional and enthusiast programmers.

First create a new final state $f$. From every old final state have an epsilon transition to the new state $f$. Add transitions to $f$ that empty the stack.
It seems best to keep the old final states. A computation of the old automaton might end in one of the old final states with an empty stack, in which case it should be accepted, but we have no contents of the stack, so we cannot move to $f$.