Model-agnostic parsing and semantics with categorical grammars