8 research outputs found

    Convergence of program transformers in the metric space of trees

    Get PDF
    AbstractIn recent years increasing consensus has emerged that program transformers, e.g. partial evaluation and unfold/fold transformations, should terminate; a compiler should stop even if it performs fancy optimizations! A number of techniques to ensure termination of program transformers have been invented, but their correctness proofs are sometimes long and involved. We present a framework for proving termination of program transformers, cast in the metric space of trees. We first introduce the notion of an abstract program transformer; a number of well-known program transformers can be viewed as instances of this notion. We then formalize what it means that an abstract program transformer terminates and give a general sufficient condition for an abstract program transformer to terminate. We also consider some specific techniques for satisfying the condition. As applications we show that termination of some well-known program transformers either follows directly from the specific techniques or is easy to establish using the general condition. Our framework facilitates simple termination proofs for program transformers. Also, since our framework is independent of the language being transformed, a single correctness proof can be given in our framework for program transformers that use essentially the same technique in the context of different languages. Moreover, it is easy to extend termination proofs for program transformers to accommodate changes to these transformers. Finally, the framework may prove useful for designing new termination techniques for program transformers

    Normalisierung und partielle Auswertung von funktional-logischen Programmen

    Get PDF
    This thesis deals with the development of a normalization scheme and a partial evaluator for the functional logic programming language Curry. The functional logic programming paradigm combines the two most important fields of declarative programming, namely functional and logic programming. While functional languages provide concepts such as algebraic data types, higher-order functions or demanddriven evaluation, logic languages usually support a non-deterministic evaluation and a built-in search for results. Functional logic languages finally combine these two paradigms in an integrated way, hence providing multiple syntactic constructs and concepts to facilitate the concise notation of high-level programs. However, both the variety of syntactic constructs and the high degree of abstraction complicate the translation into efficient target programs. To reduce the syntactic complexity of functional logic languages, a typical compilation scheme incorporates a normalization phase to subsequently replace complex constructs by simpler ones until a minimal language subset is reached. While the individual transformations are usually simple, they also have to be correctly combined to make the syntactic constructs interact in the intended way. The efficiency of normalized programs can then be improved by means of different optimization techniques. A very powerful optimization technique is the partial evaluation of programs. Partial evaluation basically anticipates the execution of certain program fragments at compile time and computes a semantically equivalent program, which is usually more efficient at run time. Since partial evaluation is a fully automatic optimization technique, it can also be incorporated into the normal compilation scheme of programs. Nevertheless, this also requires termination of the optimization process, which establishes one of the main challenges for partial evaluation besides semantic equivalence. In this work we consider the language Curry as a representative of the functional logic programming paradigm. We develop a formal representation of the normalization process of Curry programs into a kernel language, while respecting the interference of different language constructs. We then define the dynamic semantics of this kernel language, before we subsequently develop a partial evaluation scheme and show its correctness and termination. Due to the previously described normalization process, this scheme is then directly applicable to arbitrary Curry programs. Furthermore, the implementation of a practical partial evaluator is sketched based on the partial evaluation scheme, and its applicability and usefulness is documented by a variety of typical partial evaluation examples

    Una aproximaci贸n offline a la evaluaci贸n parcial dirigida por narrowing

    Full text link
    La evaluaci贸n parcial dirigida por narrowing (NPE: Narrowing-driven Partial Evaluation) es una t茅cnica potente para la especializaci贸n de sistemas de reescritura, i.e., para el componente de primer orden de muchos lenguajes declarativos (l贸gico) funcionales como Haskell, Curry o Toy. Los evaluadores parciales se clasifican en dos grandes categor铆as: online y offline, de acuerdo al momento temporal en que se consideran los aspectos de terminaci贸n del proceso de especializaci贸n. Los evaluadores parciales online son usualmente m谩s precisos ya que tienen m谩s informaci贸n disponible. Los evaluadores parciales offline proceden com煤nmente en dos etapas; la primera etapa procesa un programa (e.g., para identificar aquellas llamadas a funci贸n que se pueden desplegar sin riesgo de no terminaci贸n) e incluye anotaciones para guiar las computaciones parciales; entonces, una segunda etapa, la de evaluaci贸n parcial propiamente dicha, s贸lo tiene que obedecer las anotaciones y por tanto el especializador es mucho m谩s r谩pido que en la aproximaci贸n online. En esta tesis se presenta un nuevo esquema de evaluaci贸n parcial dirigido por narrowing, m谩s eficiente y que asegura la terminaci贸n siguiendo el estilo offline. Para ello, identificamos una caracterizaci贸n de programas cuasi-terminantes a los que llamamos "no crecientes". En tales programas, las computaciones por narrowing necesario presentan s贸lo un conjunto finito de t茅rminos diferentes (m贸dulo renombramiento de variables). La propiedad de la cuasi-terminaci贸n es importante toda vez que su presencia es regularmente una condici贸n suficiente para la terminaci贸n del proceso de especializaci贸n. Sin embargo, la clase de programas cuasi-terminantes es muy restrictiva, por lo que introducimos un algoritmo que acepta programas inductivamente secuenciales---una clase mucho m谩s amplia sobre la que est谩 definido el narrowing necesario---y anota aquellas partes que violan la caracterizaci贸n de programas no crecientes. Para procesar de maneRamos D铆az, JG. (2007). Una aproximaci贸n offline a la evaluaci贸n parcial dirigida por narrowing [Tesis doctoral no publicada]. Universitat Polit猫cnica de Val猫ncia. https://doi.org/10.4995/Thesis/10251/1888Palanci

    A Roadmap to Metacomputation by Supercompilation

    No full text
    This paper gives a gentle introduction to Turchin's supercompilation and its applications in metacomputation with an emphasis on recent developments. First, a complete supercompiler, including positive driving and generalization, is defined for a functional language and illustrated with examples. Then a taxonomy of related transformers is given and compared to the supercompiler. Finally, we put supercompilation into the larger perspective of metacomputation and consider three metacomputation tasks: specialization, composition, and inversion

    Advances in Theory:

    No full text
    Machines Stephan Diehl Session 11: Demonstrations Chair: Kyung-Goo Doh Regular Approximations of Computation Paths in Logic and Functional Languages John P. Gallagher, Laura Lafave Data Specialization of Graphics Shading Code Todd Knoblock, Erik Ruf Psychedelic Graphics Scott Draves Experiments on Partial Evaluation in APS Alexander Letichevsky Wednesday, February 14 Session 12: Supercompilation I Chair: John Hatcliff A Self-Applicable Supercompiler Andrei P. Nemytykh, Victoria A. Pinchuk, Valentin F. Turchin Specification of a Class of Supercompilers Andrei Klimov A Roadmap to Metacomputation by Supercompilation Robert Gluck, Morten Heine S酶rensen Session 13: Supercompilation II Chair: Neil D. Jones Nonstandard Semantics of Programming Languages Sergei Abramov Invited Lecture: Metacomputation: MST plus SCP Valentin F. Turchin Thursday, February 15 Session 14: Functional Programming I Chair: Charles Consel Type Specialisation for the Lambda Calculus John Hughes ..
    corecore