Move GrammarBuilder to util package