determine non-terminals in the grammar.