Constructing Customized Interpreters from Reusable Evaluators Using Game [chapter]

Stijn Timbermont, Coen De Roover, Theo D'Hondt
2012 Lecture Notes in Computer Science  
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
more » ... 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.
doi:10.1007/978-3-642-30564-1_7 fatcat:yngeh6oinve6xkkpqt4a7w2dsy