Modular specification and dynamic enforcement of syntactic language constraints when generating code