Reordering of probabilistic lexers and parsers