added linearize all function in GrammarGen