A CFG is reduced by removing useless terminals and productions. Consider the following two tasks.
(a) Nonterminals not reachable from the grammar's goal symbol are removed.
(b) Nonterminals that derive no terminal string are removed.
Does the order of the above tasks matter? If so, which order is preferred?