20 research outputs found

    A Rational Deconstruction of Landin's SECD Machine with the J Operator

    Full text link
    Landin's SECD machine was the first abstract machine for applicative expressions, i.e., functional programs. Landin's J operator was the first control operator for functional languages, and was specified by an extension of the SECD machine. We present a family of evaluation functions corresponding to this extension of the SECD machine, using a series of elementary transformations (transformation into continu-ation-passing style (CPS) and defunctionalization, chiefly) and their left inverses (transformation into direct style and refunctionalization). To this end, we modernize the SECD machine into a bisimilar one that operates in lockstep with the original one but that (1) does not use a data stack and (2) uses the caller-save rather than the callee-save convention for environments. We also identify that the dump component of the SECD machine is managed in a callee-save way. The caller-save counterpart of the modernized SECD machine precisely corresponds to Thielecke's double-barrelled continuations and to Felleisen's encoding of J in terms of call/cc. We then variously characterize the J operator in terms of CPS and in terms of delimited-control operators in the CPS hierarchy. As a byproduct, we also present several reduction semantics for applicative expressions with the J operator, based on Curien's original calculus of explicit substitutions. These reduction semantics mechanically correspond to the modernized versions of the SECD machine and to the best of our knowledge, they provide the first syntactic theories of applicative expressions with the J operator

    A Study of Syntactic and Semantic Artifacts and its Application to Lambda Definability, Strong Normalization, and Weak Normalization in the Presence of...

    Get PDF
    Church's lambda-calculus underlies the syntax (i.e., the form) and the semantics (i.e., the meaning) of functional programs. This thesis is dedicated to studying man-made constructs (i.e., artifacts) in the lambda calculus. For example, one puts the expressive power of the lambda calculus to the test in the area of lambda definability. In this area, we present a course-of-value representation bridging Church numerals and Scott numerals. We then turn to weak and strong normalization using Danvy et al.'s syntactic and functional correspondences. We give a new account of Felleisen and Hieb's syntactic theory of state, and of abstract machines for strong normalization due to Curien, Crégut, Lescanne, and Kluge

    Distributing abstract machines

    Get PDF
    Today's distributed programs are often written using either explicit message passing or Remote Procedure Calls (RPCs) that are not natively integrated in the language. It is difficult to establish the correctness of programs written this way compared to programs written for a single computer. We propose a generalisation of RPCs that are natively integrated in a functional programming language meaning that they have support for higher-order calls across node boundaries. Our focus is on how such languages can be compiled correctly and efficiently. We present four different solutions. Two of them are based on interaction semantics --- the Geometry of Interaction and game semantics --- and two are extensions of conventional abstract machines --- the Krivine machine and the SECD machine. To target as general distributed systems as possible our solutions support RPCs without sending code. We prove the correctness of the abstract machines with respect to their single-node execution, and show their viability for use for compilation by implementing prototype compilers based on them. The conventionally based machines are shown to enable efficient programs. Our intention is that these abstract machines can form the foundation for future programming languages that use the idea of higher-order RPCs

    A máquina abstracta categorial

    Get PDF
    Dissertação de mestrado em Matemática e computaçãoDesde o trabalho seminal de P. J. Landin nos anos 1960 que se têm utilizado máquinas abstractas para a implementação de linguagens de programação. Nos anos 1980 foi estabelecida uma correspondência entre o Cálculo λ e uma variante da Lógica Combinatória inspirada em categorias cartesianas fechadas. Desta relação surgiu uma máquina abstracta para a implementação do Cálculo λ — a Máquina Abstracta Categorial, ou CAM. Historicamente, esta nova máquina abstracta esteve na origem da linguagem de programação funcional Caml. Nesta dissertação explicamos como surgiu a CAM, exemplificamos o seu uso, demonstramos a sua correcção, e fazemos um enquadramento histórico à sua volta. Complementamos a literatura de referência ao formalizarmos e demonstrarmos correctas três extensões: constantes, condicionais e operador de ponto-fixo.Since the seminal work of P.J. Landin in the 1960s, abstract machines have been used for the implementation of programming languages. In the 1980s a correspondence has been established between λ-calculus and a variant of Combinatory Logic inspired by cartesian closed categories. From this relationship, an abstract machine has arised for the implementation of λ- calculus — the Categorical Abstract Machine, or CAM. Historically, this new abstract machine led to the functional programming language Caml. In this dissertation it is explained how the CAM emerged, it is illustrated its usage, it is demonstrated its correctness, and it is made an historical insersion. The reference literature is complemented by formalising and demonstrating the correctness of three extensions: constants, conditionals and fixed-point operator

    Compilation and Equivalence of Imperative Objects (Revised Report)

    Get PDF
    We adopt the untyped imperative object calculus of Abadi andCardelli as a minimal setting in which to study problems of compilationand program equivalence that arise when compiling object orientedlanguages. We present both a big-step and a small-stepsubstitution-based operational semantics for the calculus. Our firsttwo results are theorems asserting the equivalence of our substitution based semantics with a closure-based semantics like that given by Abadi and Cardelli. Our third result is a direct proof of the correctness of compilation to a stack-based abstract machine via a small-step decompilation algorithm. Our fourth result is that contextual equivalence of objects coincides with a form of Mason and Talcott's CIUequivalence; the latter provides a tractable means of establishing operational equivalences. Finally, we prove correct an algorithm, used inour prototype compiler, for statically resolving method offsets. This isthe first study of correctness of an object-oriented abstract machine,and of operational equivalence for the imperative object calculus

    Make UNCOL cool again

    Get PDF
    TCC(graduação) - Universidade Federal de Santa Catarina. Centro Tecnológico. Ciências da Computação.Criar e manter um compilador otimizador requer grandes esforços de desenvolvimento. Ao mesmo tempo, o número de compiladores necessários para traduzir cada linguagem de alto nível para várias arquiteturas de hardware cresce de forma multiplicativa. Uma possível abordagem para resolver esse problema envolve adotar uma representação intermediária comum, também conhecida como Universal Computer Oriented Language (UNCOL). Embora tal solução tenha sido proposta pela primeira vez em 1958, a tecnologia de compiladores e a teoria de linguagens de programação muito evoluíram desde então. No contexto destes avanços, o presente trabalho tem como objetivo reavaliar a ideia de uma representação intermediária universal; começando por um estudo da literatura e do estado da arte de linguagens de programação, de forma a elicitar requisitos e identificar princípios de criação para uma UNCOL moderna. Esses requisitos são a base de uma análise de algumas das representações intermediárias utilizadas em compiladores existentes. Além disso, os princípios extraídos da revisão sistemática motivaram a criação de uma nova representação intermediária, que combina técnicas de compilação originárias de diversas fontes na literatura. A nova representação intermediária é descrita em múltiplos aspectos, incluindo uma definição formal da sua estrutura em multigrafo e uma correspondência informal de sua semântica em termos de um modelo computacional já existente. Por fim, este trabalho descreve alguns algoritmos de análise e transformação de código customizados para a nova representação. Entre estes consta uma formulação de eliminação de código morto (uma otimização global) através de um algoritmo de coleção de lixo.Developing and maintaining an optimizing compiler requires great amounts of effort. At the same time, the number of compilers needed in order to translate many high-level languages to every other target architecture grows multiplicatively. One possible approach to solve this problem is the adoption of a shared intermediate representation, also known as Universal Computer Oriented Language (UNCOL). While the UNCOL solution was first proposed in 1958, there have been many developments in compiler technology and programming language theory since then. This work aims to re-evaluate the idea of a universal intermediate representation in light of these advances, beginning by surveying the programming language literature and state of the art in order to identify requirements and design principles for a modern version of UNCOL. Then, these requirements are used to analyze program representations in existing compiler infrastructures. Furthermore, the set of principles extracted from the systematic review has motivated the design of a new intermediate representation, which combines compilation techniques from various sources in the literature. Multiple aspects of the new intermediate representation are described, encompassing a formal definition of its multigraph structure, an informal explanation of its semantics in terms of the join calculus, and a few custom optimization algorithms, including a formulation of global Dead Code Elimination as a garbage collection process

    Categorical combinators

    Get PDF
    Our main aim is to present the connection between λ-calculus and Cartesian closed categories both in an untyped and purely syntactic setting. More specifically we establish a syntactic equivalence theorem between what we call categorical combinatory logic and λ-calculus with explicit products and projections, with β and η-rules as well as with surjective pairing. “Combinatory logic” is of course inspired by Curry's combinatory logic, based on the well-known S, K, I. Our combinatory logic is “categorical” because its combinators and rules are obtained by extracting untyped information from Cartesian closed categories (looking at arrows only, thus forgetting about objects). Compiling λ-calculus into these combinators happens to be natural and provokes only n log n code expansion. Moreover categorical combinatory logic is entirely faithful to β-reduction where combinatory logic needs additional rather complex and unnatural axioms to be. The connection easily extends to the corresponding typed calculi, where typed categorical combinatory logic is a free Cartesian closed category where the notion of terminal object is replaced by the explicit manipulation of applying (a function to its argument) and coupling (arguments to build datas in products). Our syntactic equivalences induce equivalences at the model level. The paper is intended as a mathematical foundation for developing implementations of functional programming languages based on a “categorical abstract machine,” as developed in a companion paper (Cousineau, Curien, and Mauny, in “Proceedings, ACM Conf. on Functional Programming Languages and Computer Architecture,” Nancy, 1985)

    Design and implementation of a low-level language for interaction nets

    Get PDF
    Interaction nets are a graphical model of computation based on a restricted form of graph rewriting. A specific net can represent a program with a user-defined set of nodes and computation is modelled by a user-defined set of rewrite rules. This very simple model has had great success in modelling sharing in computation (specifically in the lambda calculus), and there is potential for generating a new theoretical foundation of parallel computation since all computation steps are local and thus can be implemented in parallel. This thesis is about the implementation of interaction nets. Specifically, for the first contributions we define a low-level language as an object language for the compilation of interaction nets. We study the efficiency and properties of different data structures, and focus on the management of the rewriting process which is usually hidden in the graph rewriting system. We provide experimental data comparing the different choices of data structures and select one for further development. For the compilation of nets and rules into this language, we show an optimisation such that allocated memory for agents is reused, and thus we obtain optimal efficiency for the rewriting process. The second part of this thesis describes extensions of interaction nets so that they can be used as a programming language. Interaction nets in their pure form are quite restrictive in expressive power. By extending the notions of agents and rules we can express computation more naturally, yet still preserve the good properties (such as strong confluence) of the rewriting system. We then implement a selection of algorithms using and extending the compilation techniques developed in the first part of the thesis. We also demonstrate experimental results on multi-core CPUs, using the Posix-thread library, thus realising some of the potential for parallel implementation mentioned above

    Guide to Discrete Mathematics

    Get PDF

    Conservative extensions of the λ-calculus for the computational interpretation of sequent calculus

    Get PDF
    This thesis offers a study of the Curry-Howard correspondence for a certain fragment (the canonical fragment) of sequent calculus based on an investigation of the relationship between cut elimination in that fragment and normalisation. The output of this study may be summarised in a new assignment θ, to proofs in the canonical fragment, of terms from certain conservative extensions of the λ-calculus. This assignment, in a sense, is an optimal improvement over the traditional assignment φ, in that it is an isomorphism both in the sense of sound bijection of proofs and isomorphism of normalisation procedures.First, a systematic definition of calculi of cut-elimination for the canonical fragment is carried out. We study various right protocols, i.e. cut-elimination procedures which give priority to right permutation. We pay particular attention to the issue of what parts of the procedure are to be implicit, that is, performed by meta-operators in the style of natural deduction. Next, a comprehensive study of the relationship between normalisation and these calculi of cut-elimination is done, producing several new insight of independent interest, particularly concerning a generalisation of Prawitz’s mapping of normal natural deduction proofs into sequent calculus.This study suggests the definition of conservative extensions of natural deduc­tion (and λ-calculus) based on the idea of a built-in distinction between applica­tive term and application, and also between head and tail application. These extensions offer perfect counterparts to the calculi in the canonical fragment, as established by the mentioned mapping θ . Conceptual rearrangements in proof- theory deriving from these extensions of natural deduction are discussed.Finally, we argue that, computationally, both the canonical fragment and natural deduction (in the extended sense introduced here) correspond to extensions of the λ-calculus with applicative terms; and that what distinguishes them is the way applicative terms are structured. In the canonical fragment, the head application of an applicative term is “focused” . This, in turn, explains the following observation: some reduction rules of calculi in the canonical fragment may be interpreted as transition rules for abstract call-by-name machines
    corecore