Professional Documents
Culture Documents
Note: the removal of unit production has made B and the associated
productions useless.
Simplification and Normal Forms
Let L be a context-free language that does not contain λ.
Then there exists a CFG that generates L and does not have
any useless productions, O -productions, or unit-productions.
Proof
Remove λ-productions.
Remove unit-productions.
Remove useless-productions
You can refer the following topic to convert the CFG into
CNF: Chomsky normal form
Step 2: If the grammar exists left recursion, eliminate it.
If the context free grammar contains left recursion,
eliminate it. You can refer the following topic to eliminate left
recursion: Left Recursion
Step 3: In the grammar, convert the given production rule
into GNF form.
If any production rule in the grammar is not in GNF form,
convert it.
G1 is in GNF.
G2 = S → aAB | aB,
A → aA | ε,
B → bB | ε
Non-deterministic PDA
Languages accepted by NPDA
Deterministic PDA
Languages accepted by DPDA
x : incoming input
PDA a, b->c
A B
Example 1:
Construct NPDA that accepts the language
L = {xcxr | xЄ{a, b}}
Example:
Let w = abbcbba. Trace manually to
check whether w is accepted by M or not.
q1 q2
λ,z z
bba
Or
Stack symbol on the top of stack tells the PDA is on the final
state/accepted
Allowed transition
SS+XX+XY+Xx+Xx+X*Yx+Y*Xx+y*Yx+y*z