Reordering of the grammars to reduce unnecessary references.