Greibach Normal Form
Greibach Normal Form
A→b
A → bD1…Dn
S→ε
Step 2 − Remove Null productions. (Using the Null production removal algorithm discussed earlier)
Step 3 − Remove unit productions. (Using the Unit production removal algorithm discussed earlier)
Step 5 − Do proper substitutions of productions to convert it into the proper form of GNF.
Problem
S → XY | Xn | p
X → mX | m
Y → Xn | o
Solution
Here, S does not appear on the right side of any production and there are no unit or null productions in
the production rule set. So, we can skip Step 1 to Step 3.
Step 4
X in S → XY | Xo | p
with
Page 2 of 2
mX | m
we obtain
S → mXY | mY | mXo | mo | p.
X in Y → Xn | o
X → mX | m
we obtain
Y → mXn | mn | o.
Two new productions O → o and P → p are added to the production set and then we came to the final
GNF as the following −
S → mXY | mY | mXC | mC | p
X → mX | m
Y → mXD | mD | o
O→o
P→p