build grammars first