FunTAL: mixing a functional language with assembly.

Daniel Patterson, Jamie Perconti, Christos Dimoulas, Amal Ahmed.

To appear in Programming Language Design and Implementation (PLDI) 2017.

We present FunTAL, the first multi-language system to formalize safe interoperability between a high-level functional language and low-level assembly code while supporting compositional reasoning about the mix. A central challenge in developing such a multi-language is how to bridge the gap between assembly, which is staged into calls to continuations, and high-level code, where subterms return a result. We present a compositional stack-based typed assembly language that supports components, comprised of one or more basic blocks, that may be embedded in high-level contexts. We also present a logical relation for FunTAL that supports reasoning about equivalence of high-level components and their assembly replacements, mixed-language programs with callbacks between languages, and assembly components comprised of different numbers of basic blocks.

Artifact: a FunTAL type checker and small-step machine.

Daniel Patterson and Gabriel Scherer.

Source code and build instructions: github.com/dbp/funtal

We present a type checker and stepper for the FunTAL machine semantics. We include well-typed, runnable examples from the paper, as well as a few smaller examples to start with. With our artifact, you write programs and then type check / load them into a FunTAL machine. You can then step forward and backwards through the evaluation. At each step, the machine shows the registers, stack, and heap, as well as the redex and the context.

Important: the programs entered into the editor should be Fun programs at the top; a pure TAL component C can be embedded as FT[t,?]C where t is the return type, as we see in examples below. We do this so that all programs run through the stepper have a return value.

Note: there are some syntactic differences from the presentation in the paper, which nonetheless we expect will be the primary reference for the language. These changes were made to eliminate the necessity of unicode, reduce ambiguity in the grammar, and make the type checking algorithm syntax-directed. We summarize these changes at the bottom of this page.

Examples from paper:

Additional examples: Import | Simple call | Omega | Mutable reference

Examples with errors:

↓ Type check & load ↓

Step ← Step → Step →* Registers: Stack: Redex: Context/Result: Heap:

Syntactic differences from the paper: