Modified recognizer and synthesiser classes to throw more specific
exceptions.