473 research outputs found

    Algorithmic Debugging of Real-World Haskell Programs: Deriving Dependencies from the Cost Centre Stack

    Get PDF
    Existing algorithmic debuggers for Haskell require a transformation of all modules in a program, even libraries that the user does not want to debug and which may use language features not supported by the debugger. This is a pity, because a promising ap- proach to debugging is therefore not applicable to many real-world programs. We use the cost centre stack from the Glasgow Haskell Compiler profiling environment together with runtime value observations as provided by the Haskell Object Observation Debugger (HOOD) to collect enough information for algorithmic debugging. Program annotations are in suspected modules only. With this technique algorithmic debugging is applicable to a much larger set of Haskell programs. This demonstrates that for functional languages in general a simple stack trace extension is useful to support tasks such as profiling and debugging

    Supporting Separate Compilation in a Defunctionalizing Compiler

    Get PDF
    Defunctionalization is generally considered a whole-program transformation and thus incompatible with separate compilation. In this paper, we formalize a modular variant of defunctionalization which can support separate compilation. Our technique allows modules in a Haskell-like language to be separately defunctionalized and compiled, then linked together to generate an executable program. We provide a prototype implementation of our modular defunctionalization technique and we discuss the experiences of its application in a compiler from a large subset of Haskell to low-level C code, based on the intensional transformation

    The design and implementation of a relational programming system.

    Get PDF
    The declarative class of computer languages consists mainly of two paradigms - the logic and the functional. Much research has been devoted in recent years to the integration of the two with the aim of securing the advantages of both without retaining their disadvantages. To date this research has, arguably, been less fruitful than initially hoped. A large number of composite functional/logical languages have been proposed but have generally been marred by the lack of a firm, cohesive, mathematical basis. More recently new declarative paradigms, equational and constraint languages, have been advocated. These however do not fully encompass those features we perceive as being central to functional and logic languages. The crucial functional features are higher-order definitions, static polymorphic typing, applicative expressions and laziness. The crucial logic features are ability to reason about both functional and non-functional relationships and to handle computations involving search. This thesis advocates a new declarative paradigm which lies midway between functional and logic languages - the so-called relational paradigm. In a relationallanguage program and data alike are denoted by relations. All expressions are relations constructed from simpler expressions using operators which form a relational algebra. The impetus for use of relations in a declarative language comes from observations concerning their connection to functional and logic programming. Relations are mathematically more general than functions modelling non-functional as well as functional relationships. They also form the basis of many logic languages, for example, Prolog. This thesis proposes a new relational language based entirely on binary relations, named Drusilla. We demonstrate the functional and logic aspects of Drusilla. It retains the higher-order objects and polymorphism found in modern functional languages but handles non-determinism and models relationships between objects in the manner of a logic language with notion of algorithm being composed of logic and control elements. Different programming styles - functional, logic and relational- are illustrated. However, such expressive power does not come for free; it has associated with it a high cost of implementation. Two main techniques are used in the necessarily complex language interpreter. A type inference system checks programs to ensure they are meaningful and simultaneously performs automatic representation selection for relations. A symbolic manipulation system transforms programs to improve. efficiency of expressions and to increase the number of possible representations for relations while preserving program meaning

    Intensional semantics for purely functional first-order lazy data structures

    Get PDF
    Ο σκοπός αυτής της εργασίας είναι να προτείνουμε μία νοηματική σημασιολογία για οκνηρές συναρτησιακές δομές δεδομένων πρώτης τάξης. Στο θεωρητικό μέρος, ο στόχος μας είναι να ορίσουμε μία τέτοια σημασιολογία στο πλαίσιο μίας συναρτησιακής γλώσσας πρώτης τάξης με δομές δεδομένων, και να αποδείξουμε ότι είναι ισοδύναμη με τη συνήθη εκτατική σημασιολογία, τόσο για να μελετήσουμε τις ιδιότητες των οκνηρών συναρτησιακών δομών δεδομένων όσο και για να παρέχουμε μία ισχυρή θεωρητική βάση και καθοδήγηση για πιθανές υλοποιήσεις. Στο πρακτικό μέρος, περιγράφουμε μία μη-τετριμμένη υλοποίηση της σημασιολογίας, ενοποιημένη με τη νοηματική σημασιολογία για συναρτήσεις. Τέλος, συζητούμε πώς η σημασιολογία μας μπορεί να ενσωματωθεί στη νοηματική σημασιολογία για συναρτήσεις για να προκύψει μία πλήρως νοηματική σημασιολογία για συναρτησιακές γλώσσες πρώτης τάξης με δομές δεδομένων, και πώς μπορεί να επεκταθεί για να υποστηρίξει συναρτησιακές γλώσσες υψηλότερης τάξης.The purpose of this thesis is to propose an intensional semantics for purely functional first-order lazy data structures. On the theoretical side, our goal is to formally define such a semantics in the context of a first-order functional language with data structures, and prove that it is equivalent to the usual extensional semantics, both to study the properties of lazy functional data structures and to provide a robust theoretical foundation and guide for possible implementations. From a practical point of view, we describe a non-trivial implementation of our semantics that is integrated with the intensional semantics for functions. Finally, we discuss how our semantics can be formally incorporated into the intensional semantics for functions to obtain a fully intensional semantics for first-order functional languages with data structures, and how it can be extended to support higher-order functions

    An efficient implementation of lazy functional programming languages based on the generalized intensional transformation

    Get PDF
    Αυτή η εργασία διερευνά θεωρητικά και πρακτικά ζητήματα της αλληλεπίδρασης μεταξύ (ευρέως γνωστών και νέων) τεχνικών μεταγλώττισης, όπως ο γενικευμένος νοηματικός μετασχηματισμός, ο μετασχηματισμός σε συναρτησιακά αντικείμενα, η ξεχωριστή μεταγλώττιση και η λάμβδα άρση. Ένας πειραματικός μεταγλωττιστής για τη γλώσσα Haskell (GIC), ο οποίος χρησιμοποιεί τις τεχνικές αυτές, δίνει τη δυνατότητα σε νέες ιδέες να υλοποιηθούν και να αξιολογηθούν μέσα σε ένα πρακτικό πλαίσιο. Ως μέρος αυτής της δουλειάς πραγματοποιήθηκαν διάφορες προσθήκες και αλλαγές στο μεταγλωττιστή, είτε προκειμένου να γίνει ο μεταγλωττιστής πληρέστερος είτε προκειμένου να βελτιωθεί ο τελικός κώδικας που παράγεται από το LAR back-end του μεταγλωττιστή.This dissertation investigates theoretical and practical issues of the integration between (well-known and novel) compilation techniques, such as the generalized intensional transformation, defunctionalization, separate compilation, and lambda lifting. An experimental Haskell compiler (GIC), which incorporates these techniques, serves as a workbench allowing ideas to be demonstrated and evaluated in a practical context. Within the scope of this work, several additions and changes were made to the compiler either towards enchancing the tool’s robustness or towards the optimization of the code generated by the compiler’s LAR back-end

    Object-Oriented Intensional Programming: Intensional Classes Using Java and Lucid

    Full text link
    This article introduces Object-Oriented Intensional Programming (OO-IP), a new hybrid language between Object-Oriented and Intensional Programming Languages in the sense of the latest evolutions of Lucid. This new hybrid language combines the essential characteristics of Lucid and Java, and introduces the notion of object streams which makes it is possible that each element in a Lucid stream to be an object with embedded intensional properties. Interestingly, this hybrid language also brings to Java objects the power to explicitly express and manipulate the notion of context, creating the novel concept of intensional object, i.e. objects whose evaluation is context-dependent, which are here demonstrated to be translatable into standard objects. By this new approach, we extend the use and meaning of the notion of intensional objects and enrich the meaning of object streams in Lucid and semantics of intensional objects in Java.Comment: 27 pages, 8 listings, 2 tables, 5 figure

    An intensional implementation technique for functional languages

    Get PDF
    The potential of functional programming languages has not been widely accepted yet. The reason lies in the difficulties associated with their implementation. In this dissertation we propose a new implementation technique for functional languages by compiling them into 'Intensional Logic' of R. Montague and R. Carnap. Our technique is not limited to a particular hardware or to a particular evaluation strategy; nevertheless it lends itself directly to demand-driven tagged dataflow architecture. Even though our technique can handle conventional languages as well, our main interest is exclusively with functional languages in general and with Lucid-like dataflow languages in particular. We give a brief general account of intensional logic and then introduce the concept of intensional algebras as structures (models) for intensional logic. We, formally, show the computability requirements for such algebras. The target language of our compilation is the family of languages DE (definitional equations over intensional expressions). A program in DE is a linear (not structured) set of non-ambiguous equations defining nullary variable symbols. One of these variable symbols should be the symbol result. We introduce the compilation of Iswim (a first order variant of Landin's ISWIM) as an example of compiling functions into intensional expressions. A compilation algorithm is given. Iswim(A), for any algebra of data types A, is compiled into DE(Flo(A)) where Flo(A) is a uniquely defined intensional algebra over the tree of function calls. The approach is extended to compiling Luswim and Lucid. We describe the demand-driven tagged dataflow (the eduction) approach to evaluating the intensional family of target languages DE. Furthermore, for each intensional algebra, we introduce a collection of rewrite rules. A justification of correctness is given. These rules are the basis for evaluating programs in the target DE by reduction. Finally, we discuss possible refinements and extensions to our approach
    corecore