add tests for Grammar.transform