Write down the algorithm to remove useless symbols to simplify the CFG.
These variable or terminals are useless that don’t appear in any production of a terminal string from the start symbol.
It has two steps:
(i) Generating
(ii) Reachable
An algorithm to remove useless symbols to simplify the CFG:
begin
(i) OLD V: = ∅ ;
(ii) NEW V: {A | A → W for some w in T*};
(iii) While OLD V ≠ NEW V do
begin
(iv) OLD V: = NEW V
(v) NEW V: = OLD ∪ {A | A → ∞ for some ∞ in (T ∪ OLD V)*}
end;
(vi) V^': = NEW V
end.
No comments
Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....