Constructing Customized Interpreters from Reusable Evaluators Using Game
Separation of concerns is difficult to achieve in the implementation of a programming language interpreter. We argue that evaluator concerns (i.e., those implementing the operational semantics of the language) are, in particular, difficult to separate from the runtime concerns (e.g., memory and stack management) that support them. This precludes the former from being reused and limits variability in the latter.
In this paper, we present the Game environment for composing customized interpreters from a reusable evaluator and different variants of its supporting runtime. To this end, Game offers a language for specifying the evaluator according to the generic programming methodology. Through a transformation into defunctionalized monadic style, the Game toolchain generates a generic abstract machine in which the sequencing of low-level interpretational steps is parameterized. Given a suitable instantiation of these parameters for a particular runtime, the toolchain is able to inject the runtime into the generic abstract machine such that a complete interpreter is generated.
To validate our approach, we port the prototypical Scheme evaluator to Game and compose the resulting generic abstract machine with several runtimes that vary in their automatic memory management as well as their stack discipline.
KeywordsOperational Semantic Abstract Machine Require Dependency Root Pointer Supporting Runtime
Unable to display preview. Download preview PDF.
- 2.Ager, M.S., Biernacki, D., Danvy, O., Midtgaard, J.: A functional correspondence between evaluators and abstract machines. In: Proc. of the 5th ACM SIGPLAN Intl. Conf. on Principles and Practice of Declaritive Programming, PPDP 2003, pp. 8–19. ACM, New York (2003)Google Scholar
- 6.Anton Ertl, M., Gregg, D.: The structure and performance of efficient interpreters. Journal of Instruction-Level Parallelism 5, 1–25 (2003)Google Scholar
- 10.Herzeel, C., Costanza, P.: Dynamic parallelization of recursive code: part 1: managing control flow interactions with the continuator. In: Proc. of the ACM Intl. Conf. on Object Oriented Programming Systems Languages and Applications, OOPSLA 2010, pp. 377–396. ACM, New York (2010)CrossRefGoogle Scholar