- If dealing with a pushdown automaton, convert it into a CFG.
- Call a variable generating if it derives a string of
terminals.
- Mark a variable X as "generating" if it has a production X -> w
where w is a string of only terminals and/or variables previously
marked "generating".
- Repeat the step above until no further variables get marked "generating".
All variables not marked "generating" are non-generating (by a simple
induction of the length of derivations).
- The language is empty if and only if the start symbol is non-generating.