The concept of extended PushDown Automatons can be used to convert a Context-Free Grammar (CFG) to a PushDown Automaton (PDA).
Consider the following CFG
States
The extended PDA will have three states (the start state), (the work state) and (the only final state).
We have to push the symbol (indicating the bottom of the stack) and the start variable () onto the stack. Thus, the transition between these two states will be .
We have to check for the bottom of the stack. Thus, the transition between these two states will be .
Rules as transitions
For every rule of the type , add the transition that loops on .
In essence, these transitions simulate an application of a rule.
Terminals as transitions
For any , add the transition that loops on .
The reason this transition is added is to match the terminals generated by the CFG rules with the symbols the PDA reads.
The difference between PDAs and CFGs is that the former reads a string while the the latter generates a string. For the PDA to accept a string, it needs to read the symbols in the strings that can be generated by the PDA.
Conversion to PDA
The extended PDA transitions can be broken down into just PDA transitions by following the steps outlined here.