A unit production is one of the form
, where both
and
are single non-terminals.
What this basically says is that
is the same as
, since any where we see one we can
replace it with the other. Thus we can shorten or grammar without changing the accepted
language by eliminating this type of production rule.
For any non-terminal , we say that a non-terminal
is
-derivable if there exists some
derivation
. Obviously this type of derivation will be effected by the
elimination of unit productions.
To eliminate unit productions from a grammar, we perform the following: