Convert grammars to closures.