We present a formal translation of a resource-Aware extension of the Abstract Behavioral Specification (ABS) language to the functional language Haskell. ABS is an actor-based language tailored to the modeling of distributed systems. It combines asynchronous method calls with a suspend and resume mode of execution of the method invocations. To cater for the resulting cooperative scheduling of the method invocations of an actor, the translation exploits for the compilation of ABS methods Haskell functions with continuations. The main result of this article is a correctness proof of the translation by means of a simulation relation between a formal semantics of the source language and a high-level operational semantics of the target language, i.e., a subset of Haskell. We further prove that the resource consumption of an ABS program extended with a cost model is preserved over this translation, as we establish an equivalence of the cost of executing the ABS program and its corresponding Haskell-Translation. Concretely, the resources consumed by the original ABS program and those consumed by the Haskell program are the same, considering a cost model. Consequently, the resource bounds automatically inferred for ABS programs extended with a cost model, using resource analysis tools, are sound resource bounds also for the translated Haskell programs. Our experimental evaluation confirms the resource preservation over a set of benchmarks featuring different asymptotic costs.

Actor model, Continuation, Cooperative multitasking, Coroutine, Functional programming, Futures, Operational semantics
Fundamenta Informaticae
Centrum Wiskunde & Informatica, Amsterdam, The Netherlands

Albert, E, Bezirgiannis, N, de Boer, F.S, & Martin-Martin, E. (2020). A formal, resource consumption-preserving translation from actors with cooperative scheduling to Haskell. Fundamenta Informaticae, 177(3-4), 203–234. doi:10.3233/FI-2020-1988