All grammars are not always optimized, which means the grammar may consist of some extra symbols (non-terminals) which increase the length of grammar.
So, we have to reduce the grammar by removing the useless symbols.
The properties to reduce grammar are explained below −
The diagram given herewith describe the properties to reduce grammar −
The unit productions are the productions in which one non-terminal gives another nonterminal
The steps to remove the unit production are given below −
Consider the context free grammar given below and remove unit production for the same.
S->C is unit production but while removing S->C we have to consider what C gives so we can add a rule to S.
B->A is also unit production
Finally, we can write CFG without unit production as follows −