Added classes for terminal and non-terminals.