For several years now, domain-specific languages (DSLs) are a mainstream tool for establishing model-based development environments in real-world projects. Typical back-end tools for external DSLs are interpreters and code generators.
Partial evaluation is a well-known technique for program specialization, with the use case of specializing interpreters to target programs. However, the automatic generation of code generators from a DSL’s interpreter is by no means ubiquitous in industrial DSL projects. In this paper, we show how interpreters for a DSL can be used as a basis for automatic generation of efficient target code. This is possible by implementing a partial evaluator for the mainstream DSL toolset Xtext/Xtend.