An extended BNF syntax lets users define new domain-specific languages or parse existing formats, and a template-based syntax lets users write patterns for generating code. The code generation knows how to preserve protected areas with hand-typed code and offers code expansion, source-to-source translation, and program transformation.