A Symmetric Approach to Compilation and Decompilation

  • Mads Sig Ager
  • Olivier Danvy
  • Mayer Goldberg

Abstract

Just as specializing a source interpreter can achieve compilation from a source language to a target language, we observe that specializing a target interpreter can achieve compilation from the target language to the source language. In both cases, the key issue is the choice of whether to perform an evaluation or to emit code that represents this evaluation.

We substantiate this observation by specializing two source interpreters and two target interpreters. We first consider a source language of arithmetic expressions and a target language for a stack machine, and then the lambda-calculus and the SECD-machine language. In each case, we prove that the target-to-source compiler is a left inverse of the source-to-target compiler, i.e., it is a decompiler.

In the context of partial evaluation, compilation by source-interpreter specialization is classically referred to as a Futamura projection. By symmetry, it seems logical to refer to decompilation by target-interpreter specialization as a Futamura embedding.
Published
2002-08-05
How to Cite
Ager, M., Danvy, O., & Goldberg, M. (2002). A Symmetric Approach to Compilation and Decompilation. BRICS Report Series, 9(37). https://doi.org/10.7146/brics.v9i37.21752