public static Set getTerminalProductions(Grammar grammar) {
		Set terminalDerivers = new TreeSet();
		Production[] p = grammar.getProductions();
		for (int i = 0; i < p.length; i++) {
			String lhs = p[i].getLHS();
			if (terminalDerivers.contains(lhs))
				continue;
			String rhs = p[i].getRHS();
			for (int k = 0; k < rhs.length(); k++) {
				char ch = rhs.charAt(k);
				if (ProductionChecker.isVariable(ch)) {
					lhs = null;
					break;
				}
			}
			if (lhs == null)
				continue;
			terminalDerivers.add(lhs);
		}
		return terminalDerivers;
	}