Perform some manual CSE on the grammar. No functional changes.