Grammar Refactoring