1. A method of building a learned context free grammar (CFG) for an application, comprising: generating a semantic schema for the application, the semantic schema having associated semantic constraints; generating a template grammar based on the semantic schema such that the template grammar inherits the semantic constraints associated with the semantic schema; and building the learned CFG by parsing training expressions using the template grammar.