A pushdown
A PDA consists of three main components:
The stack has two functions: push and pop. At every step, the PDA makes a decision to push an element from the input, or pop an element from the stack. The stack contains a starting/stopping symbol ($ or Z) that indicates the end of a stack.
A PDA is a 7-tuple automata
There are several notations to show transitions. The following graph shows one of these transition notations in PDA:
Where
Note: It is not necessary to consume the input to move to another state. We can also make a transition non-deterministically (a null transition) where
is ^.
The turnstile notation shows a transition without a graph. It uses instantaneous description (ID) to do so.
IDs include
For example,
In this transition, the state changes from
Let's see a few examples to clarify things further:
We can't specify
Let's suppose
The PDA above is a non-deterministic PDA that can make a null or epsilon transition. Here, the PDA keeps pushing the elements into the stack.
In the case of an even palindrome, it stops until the first half of the input is consumed. In the case of an odd palindrome, it looks for element
The PDA then compares the input with the stack elements and pops them if it finds a match. At the end of the input, if the stack only contains
or
conditionWe now look at a slightly complex example.
Let's suppose the following:
As the language contains an or
condition, the states change non-deterministically. That is, the
In the path above, the number of
In the path below, the number of
Free Resources