A pushdown automaton (PDA) is a finite automaton with a stack for memory purposes. A nondeterministic pushdown automaton (NPDA) has one, or more than one, transition for each input that it reads.
A context-free grammar (CFG) is the generator of a language, whereas a PDA and NPDA are the recognizers of a non-regular language.
A PDA is defined by six tuples
To convert a CFG to an NPDA, we follow these steps:
The components of making a PDA are writing the steps that construct the PDA and the pushdown automaton itself.
Let's take an example of the following CFG:
Input nothing from the CFG, pop nothing from the stack as it is already empty, and push
Push
Read all possible inputs from the CFG, pop the same input from the stack, and push the productions they produce accordingly.
In the case of the start variable, as it is already on the top of the stack initially, pop it and push all the productions it creates.
After all the productions have been read, pushed, and popped, only the
This is the final form of the NPDA formed by the CFG, where:
Note: To learn more about PDA, we can visit here.
Free Resources