@article{Danvy_Vestergaard_1996, title={Semantics-Based Compiling: A Case Study in Type-Directed Partial Evaluation}, volume={3}, url={https://tidsskrift.dk/brics/article/view/19976}, DOI={10.7146/brics.v3i13.19976}, abstractNote={<p>We illustrate a simple and effective solution to semantics-based<br />compiling. Our solution is based on type-directed partial evaluation, where</p><p><br />- our compiler generator is expressed in a few lines, and is efficient; <p> - its input is a well-typed, purely functional definitional interpreter in the manner of denotational semantics;</p>- the output of the generated compiler is three-address code, in the fashion and efficiency of the Dragon Book;</p><p>- the generated compiler processes several hundred lines of source code per second.</p><p><br />The source language considered in this case study is imperative, block-structured,<br />higher-order, call-by-value, allows subtyping, and obeys<br />stack discipline. It is bigger than what is usually reported in the literature on semantics-based compiling and partial evaluation.<br />Our compiling technique uses the first Futamura projection, i.e., we compile programs by specializing a definitional interpreter with respect to this program. Our denitional interpreter is completely straightforward, stack-based, and in direct style. In particular, it requires no clever staging technique (currying, continuations, binding-time improvements, etc.), nor does it rely on any other framework (attribute grammars, annotations, etc.) than the typed lambda-calculus. In particular, it uses no other program analysis than traditional type inference. The overall simplicity and effectiveness of the approach has encouraged us to write this paper, to illustrate this genuine solution to denotational semantics-directed compilation, in the spirit of Scott and Strachey.</p>}, number={13}, journal={BRICS Report Series}, author={Danvy, Olivier and Vestergaard, René}, year={1996}, month={Jan.} }