224 research outputs found

    Parametric Compositional Data Types

    Get PDF
    In previous work we have illustrated the benefits that compositional data types (CDTs) offer for implementing languages and in general for dealing with abstract syntax trees (ASTs). Based on Swierstra's data types \'a la carte, CDTs are implemented as a Haskell library that enables the definition of recursive data types and functions on them in a modular and extendable fashion. Although CDTs provide a powerful tool for analysing and manipulating ASTs, they lack a convenient representation of variable binders. In this paper we remedy this deficiency by combining the framework of CDTs with Chlipala's parametric higher-order abstract syntax (PHOAS). We show how a generalisation from functors to difunctors enables us to capture PHOAS while still maintaining the features of the original implementation of CDTs, in particular its modularity. Unlike previous approaches, we avoid so-called exotic terms without resorting to abstract types: this is crucial when we want to perform transformations on CDTs that inspect the recursively computed CDTs, e.g. constant folding.Comment: In Proceedings MSFP 2012, arXiv:1202.240

    Strict Ideal Completions of the Lambda Calculus

    Get PDF
    The infinitary lambda calculi pioneered by Kennaway et al. extend the basic lambda calculus by metric completion to infinite terms and reductions. Depending on the chosen metric, the resulting infinitary calculi exhibit different notions of strictness. To obtain infinitary normalisation and infinitary confluence properties for these calculi, Kennaway et al. extend β\beta-reduction with infinitely many `⊥\bot-rules', which contract meaningless terms directly to ⊥\bot. Three of the resulting B\"ohm reduction calculi have unique infinitary normal forms corresponding to B\"ohm-like trees. In this paper we develop a corresponding theory of infinitary lambda calculi based on ideal completion instead of metric completion. We show that each of our calculi conservatively extends the corresponding metric-based calculus. Three of our calculi are infinitarily normalising and confluent; their unique infinitary normal forms are exactly the B\"ohm-like trees of the corresponding metric-based calculi. Our calculi dispense with the infinitely many ⊥\bot-rules of the metric-based calculi. The fully non-strict calculus (called 111111) consists of only β\beta-reduction, while the other two calculi (called 001001 and 101101) require two additional rules that precisely state their strictness properties: λx.⊥→⊥\lambda x.\bot \to \bot (for 001001) and ⊥ M→⊥\bot\,M \to \bot (for 001001 and 101101)

    Modal FRP for all: Functional reactive programming without space leaks in Haskell

    Get PDF

    From infinitary term rewriting to cyclic term graph rewriting and back

    Get PDF

    Cutting out continuations

    Get PDF
    In the field of program transformation, one often transforms programs into continuation-passing style to make their flow of control explicit, and then immediately removes the resulting continuations using defunctionalisation to make the programs first-order. In this article, we show how these two transformations can be fused together into a single transformation step that cuts out the need to first introduce and then eliminate continuations. Our approach is calculational, uses standard equational reasoning techniques, and is widely applicable

    Compiling a 50-year journey

    Get PDF
    Fifty years ago, John McCarthy and James Painter (1967) published the first paper on compiler verification, in which they showed how to formally prove the correctness of a compiler that translates arithmetic expressions into code for a register-based machine. In this article, we revisit this example in a modern context, and show how such a compiler can now be calculated directly from a specification of its correctness using simple equational reasoning techniques
    • …
    corecore