Discovery of hierarchical production rules with exceptions