Results 1 -
8 of
8
Representing control: a study of the CPS transformation
, 1992
"... This paper investigates the transformation of v -terms into continuation-passing style (CPS). We show that by appropriate j-expansion of Fischer and Plotkin's two-pass equational specification of the CPS transform, we can obtain a static and context-free separation of the result terms into "esse ..."
Abstract
-
Cited by 69 (6 self)
- Add to MetaCart
This paper investigates the transformation of v -terms into continuation-passing style (CPS). We show that by appropriate j-expansion of Fischer and Plotkin's two-pass equational specification of the CPS transform, we can obtain a static and context-free separation of the result terms into "essential" and "administrative" constructs. Interpreting the former as syntax builders and the latter as directly executable code, we obtain a simple and efficient one-pass transformation algorithm, easily extended to conditional expressions, recursive definitions, and similar constructs. This new transformation algorithm leads to a simpler proof of Plotkin's simulation and indifference results. Further we show how CPS-based control operators similar to but more general than Scheme's call/cc can be naturally accommodated by the new transformation algorithm. To demonstrate the expressive power of these operators, we use them to present an equivalent but even more concise formulation of t...
Embedding prolog in haskell
- Department of Computer Science, University of Utrecht
, 1999
"... The distinctive merit of the declarative reading of logic programs is the validity ofallthelaws of reasoning supplied by the predicate calculus with equality. Surprisingly many of these laws are still valid for the procedural reading � they can therefore be used safely for algebraic manipulation, pr ..."
Abstract
-
Cited by 16 (4 self)
- Add to MetaCart
The distinctive merit of the declarative reading of logic programs is the validity ofallthelaws of reasoning supplied by the predicate calculus with equality. Surprisingly many of these laws are still valid for the procedural reading � they can therefore be used safely for algebraic manipulation, program transformation and optimisation of executable logic programs. This paper lists a number of common laws, and proves their validity for the standard (depth- rst search) procedural reading of Prolog. They also hold for alternative search strategies, e.g. breadth- rst search. Our proofs of the laws are based on the standard algebra of functional programming, after the strategies have been given a rather simple implementation in Haskell. 1
Prolog's Control Constructs in a Functional . . .
- INTERNATIONAL JOURNAL OF FOUNDATIONS OF COMPUTER SCIENCE
"... The purpose of this article is twofold. First, we show that Prolog's control constructs can be smoothly integrated into a functional language like Haskell. The resulting `language', termed embedded Prolog, incorporates many of the features prescribed by the Prolog ISO standard: control constructs ..."
Abstract
-
Cited by 10 (5 self)
- Add to MetaCart
The purpose of this article is twofold. First, we show that Prolog's control constructs can be smoothly integrated into a functional language like Haskell. The resulting `language', termed embedded Prolog, incorporates many of the features prescribed by the Prolog ISO standard: control constructs including the cut, all solution collecting functions, and error handling facilities. Embedded Prolog lacks some concepts such as logical variables but it inherits all of Haskell's strengths, eg static polymorphic typing, higher order functions etc. Technically, the integration is achieved using monads and monad transformers. One of the main innovations is the de nition of a backtracking monad transformer, which allows us to combine backtracking with exception handling and interaction. Second, we work towards an axiomatization of the operations, through which the computational features are accessed. Equations are used to lay down the meaning of the various operations and their interrelations enabling the programmer to reason about programs in a simple calculational style. The axiomatization is applied to show that each nite computation has a simple canonical form.
High-level Management of Computation History for the Design and Implementation of a Prolog System
, 1992
"... this paper is to demonstrate how it is possible to implement a complete Prolog system by guaranteeing the double goals of high expressiveness in software description and of efficiency of the resulting system. The fulfilment of these objectives has been possible thanks to a set of tools designed for ..."
Abstract
-
Cited by 7 (4 self)
- Add to MetaCart
this paper is to demonstrate how it is possible to implement a complete Prolog system by guaranteeing the double goals of high expressiveness in software description and of efficiency of the resulting system. The fulfilment of these objectives has been possible thanks to a set of tools designed for efficient manipulation of the computation history. These tools, which have been implemented in C, are called `sleepers'. The adoption of these mechanisms leads to a new programming paradigm for which we propose the term `sleeper-oriented programming'. The Prolog system that we have implemented is entirely conceived in this programming style. The implementation choices, the term representation, the memory organization (local stack, heap, trail), and the resource management (last-call optimization) are closely related to the standard implementations of Prolog. The main originality of the system lies in the fact that the traditional Prolog local stack is amalgamated with the runtime stack of the host language, and that this resource, normally so hard to handle in a friendly manner, is easily usable by the sleeper mechanism
Prological Features In A Functional Setting Axioms And Implementations
- In Third Fuji Int. Symp. on Functional and Logic Programming
, 1998
"... this paper is twofold. First, we show that Prological features ..."
Abstract
-
Cited by 5 (0 self)
- Add to MetaCart
this paper is twofold. First, we show that Prological features
Continuations in λProlog
- 10th Int. Conf. Logic Programming
, 1993
"... Continuations are well known in functional programming where they have been used to transform and compile programs. Some languages provide explicit manipulations of the continuation for the user: The user can catch and modify the current continuation. Continuations have also been used in the logic p ..."
Abstract
- Add to MetaCart
Continuations are well known in functional programming where they have been used to transform and compile programs. Some languages provide explicit manipulations of the continuation for the user: The user can catch and modify the current continuation. Continuations have also been used in the logic programming context to give a denotational semantics for Prolog, to generate Prolog compilers and to transform Prolog programs. In this paper, we propose to introduce new built-ins in a logic programming language to enable the user to explicitly replace the continuations. These built-ins allow the user to have a new control of the execution. We choose Prolog because of its higher-order syntax and implications in the goals which are necessary for the definition and use of these built-ins. In order to define the built-ins, we extend to Prolog the Prolog semantics based on continuations. Then, we show that an exception mechanism can be easily implemented using these new built-ins. The proposed s...

