DeepAI AI Chat
Log In Sign Up

Automating the Functional Correspondence between Higher-Order Evaluators and Abstract Machines

08/16/2021
by   Maciej Buszka, et al.
0

The functional correspondence is a manual derivation technique transforming higher-order evaluators into the semantically equivalent abstract machines. The transformation consists of two well-known program transformations: translation to continuation-passing style that uncovers the control flow of the evaluator and Reynolds's defunctionalization that generates a first-order transition function. Ever since the transformation was first described by Danvy et al. it has found numerous applications in connecting known evaluators and abstract machines, but also in discovering new abstract machines for a variety of λ-calculi as well as for logic-programming, imperative and object-oriented languages. We present an algorithm that automates the functional correspondence. The algorithm accepts an evaluator written in a dedicated minimal functional meta-language and it first transforms it to administrative normal form, which facilitates program analysis, before performing selective translation to continuation-passing style, and selective defunctionalization. The two selective transformations are driven by a control-flow analysis that is computed by an abstract interpreter obtained using the abstracting abstract machines methodology, which makes it possible to transform only the desired parts of the evaluator. The article is accompanied by an implementation of the algorithm in the form of a command-line tool that allows for automatic transformation of an evaluator embedded in a Racket source file and gives fine-grained control over the resulting machine.

READ FULL TEXT

page 1

page 2

page 3

page 4

02/25/2023

Suspension Analysis and Selective Continuation-Passing Style for Higher-Order Probabilistic Programming Languages

Probabilistic programming languages (PPLs) make encoding and automatical...
10/25/2019

Selective Lambda Lifting

Lambda lifting is a well-known transformation, traditionally employed fo...
07/15/2017

Abstracting Definitional Interpreters

In this functional pearl, we examine the use of definitional interpreter...
10/24/2020

The (In)Efficiency of Interaction

Evaluating higher-order functional programs through abstract machines in...
11/19/2021

Continuation-Passing Style, Defunctionalization, Accumulations, and Associativity

Context: Reynolds showed us how to use continuation-passing style and de...
02/19/2018

Space Improvements and Equivalences in a Functional Core Language

We explore space improvements in LRP, a polymorphically typed call-by-ne...
02/11/2021

Strong Call by Value is Reasonable for Time

The invariance thesis of Slot and van Emde Boas states that all reasonab...