## A Parallel Functional Language With First-Class Continuations. Programming Style and Semantics (0)

Venue: | Computers and Artificial Intelligence |

Citations: | 1 - 0 self |

### BibTeX

@ARTICLE{Moreau_aparallel,

author = {Luc Moreau},

title = {A Parallel Functional Language With First-Class Continuations. Programming Style and Semantics},

journal = {Computers and Artificial Intelligence},

year = {},

volume = {14}

}

### OpenURL

### Abstract

We present an operational semantics for a functional language with rst-class continuations and transparent constructs for parallelism fork and pcall. The sequential semantics of programs with rst-class continuations is preserved when parallel evaluation is allowed, by verifying whether some expressions have returned a value before applying a continuation. These expressions are the ones that are evaluated before this continuation is applied in a left-to-right sequential order. An implementation is proposed using a notion of higher-order continuation that we call metacontinuation. This semantics is costless when rst-class continuations are not used. Several programs also illustrate the programming style that can be adopted in such a language. Keywords: Scheme, parallelism, transparency, continuation, metacontinuation, left expression, operational semantics. 1 Introduction There are essentially two trends to extend a functional language with parallel constructs. On the one...

### Citations

1569 | The Definition of Standard ML
- MILNER, TOFTE, et al.
- 1990
(Show Context)
Citation Context ... expression, operational semantics. 1 Introduction There are essentially two trends to extend a functional language with parallel constructs. On the one hand, the approach adopted by the ML community =-=[22]-=- consists in adding to the language the notions of processes, channels, and communications as in calculi like CCS [21]. An operational semantics is given in [2] and several implementations were realis... |

447 | Multilisp: A language for concurrent symbolic computation
- Halstead
- 1985
(Show Context)
Citation Context ...tions. On the other hand, one can preserve the functional features of the language by adding constructs like future and pcall. These constructs were initially implemented in MultiLisp as described in =-=[9]-=-, [10]. Such operators are said to be transparent since programs using them return the same results as their sequentialised versions (i.e. these programs where those operators were deleted). Thus, tho... |

300 | Definitional interpreters for higher-order programming languages
- Reynolds
- 1972
(Show Context)
Citation Context ...tion of the sequential subset of C using the continuationpassing style or CPS for short. The CPS translation is an old idea in computer science; it was initially proposed by Fisher [8] and Reynolds [=-=33]-=-, and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers [3], [4], [34], [35], [1]. In our notation, a translation... |

220 |
Call-by-name, call-by-value and the #-calculus
- Plotkin
- 1975
(Show Context)
Citation Context ... 0 e 1 : : : e j ), there is a transition to the second conguration where p n evaluates (v 1 : : : v i e 00 e 1 : : : e j ) where left terms of e 0 are values". Rule 2 is the call-byvalues-reduct=-=ion [-=-27]. According to rule 3, the evaluation of a lambda-expression x:M yields a triple hx; M;i, called a function. One should remark that a function contains a fresh location which allows us to compare ... |

161 | Reasoning about programs in continuation-passing style
- Sabry, Felleisen
- 1993
(Show Context)
Citation Context ...tially proposed by Fisher [8] and Reynolds [33], and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers [3], [4], =-=[34-=-], [35], [1]. In our notation, a translation consists of a set of translation rules having the following pattern: [[Term]]=exp. The left-hand side of the rule is a source term of C in brackets and th... |

111 | Continuation-passing, closure-passing style
- Appel, Jim
- 1989
(Show Context)
Citation Context ...sed by Fisher [8] and Reynolds [33], and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers [3], [4], [34], [35], =-=[1-=-]. In our notation, a translation consists of a set of translation rules having the following pattern: [[Term]]=exp. The left-hand side of the rule is a source term of C in brackets and the right-han... |

100 | Lambda calculus schemata
- Fischer
- 1972
(Show Context)
Citation Context ...isplays a translation of the sequential subset of C using the continuationpassing style or CPS for short. The CPS translation is an old idea in computer science; it was initially proposed by Fisher [=-=8]-=- and Reynolds [33], and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers [3], [4], [34], [35], [1]. In our notat... |

83 |
Control operators, the SECD machine and the -calculus
- Felleisen, Friedman
- 1986
(Show Context)
Citation Context ...er paper [25], we dene the CPP-calculus as an extension of the call-by-value lambda-calculus [27] with a control operator call/cc. The CPP-calculus diers from Felleisen and Friedman's c -calculus [5]=-=-=-, [7] because call/cc is not the origin of a bottleneck in the CPP-calculus. The CPP-calculus contains reduction rules that allow the capture of continuations in any context, even when left expression... |

81 | A semantics for ML concurrency primitives
- Berry, Milner, et al.
- 1992
(Show Context)
Citation Context ...e approach adopted by the ML community [22] consists in adding to the language the notions of processes, channels, and communications as in calculi like CCS [21]. An operational semantics is given in =-=[2]-=- and several implementations were realised (PFL [17], CML [32]). Its main drawbacks are that the language is no longer functional and that it requires another programming methodology to develop parall... |

56 |
Danvy and Andrzej Filinski. Abstracting Control
- Olivier
- 1990
(Show Context)
Citation Context ...it was initially proposed by Fisher [8] and Reynolds [33], and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers =-=[3-=-], [4], [34], [35], [1]. In our notation, a translation consists of a set of translation rules having the following pattern: [[Term]]=exp. The left-hand side of the rule is a source term of C in brac... |

56 |
Legal Theory
- Friedman
- 1953
(Show Context)
Citation Context ...per [25], we dene the CPP-calculus as an extension of the call-by-value lambda-calculus [27] with a control operator call/cc. The CPP-calculus diers from Felleisen and Friedman's c -calculus [5], [7]=-=-=- because call/cc is not the origin of a bottleneck in the CPP-calculus. The CPP-calculus contains reduction rules that allow the capture of continuations in any context, even when left expressions are... |

51 | Back to direct style II: Firstâ€“class continuations
- Danvy, Lawall
- 1992
(Show Context)
Citation Context ...s initially proposed by Fisher [8] and Reynolds [33], and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers [3], =-=[4-=-], [34], [35], [1]. In our notation, a translation consists of a set of translation rules having the following pattern: [[Term]]=exp. The left-hand side of the rule is a source term of C in brackets ... |

48 |
Dybvig. Continuations and concurrency
- Hieb, Kent
- 1990
(Show Context)
Citation Context ...d approach, with transparent constructs, is commonly used to add parallelism to Scheme. However,srst-class continuations gave a hard time to researchers to dene a transparent future construct ([19], [=-=16]-=-, [18], [20], [11]). Sequential programs are characterised by asxed evaluation order (that we assume to be from left to right in this paper). This evaluation order does not exist any longer when paral... |

38 | MultiScheme: A Parallel Processing System - Miller - 1987 |

33 |
New ideas in parallel Lisp: Language design, implementation, and programming tools
- Halstead
- 1989
(Show Context)
Citation Context ...ransparent constructs, is commonly used to add parallelism to Scheme. However,srst-class continuations gave a hard time to researchers to dene a transparent future construct ([19], [16], [18], [20], [=-=11]-=-). Sequential programs are characterised by asxed evaluation order (that we assume to be from left to right in this paper). This evaluation order does not exist any longer when parallel constructs are... |

31 |
Continuations and Coroutines
- Haynes, Friedman, et al.
- 1984
(Show Context)
Citation Context ...ations are useful to dene powerful control structures, such as escape mechanisms, abortion and resumption of computations, coroutines; several programming examples with continuations can be found in [=-=14]-=-, [15]. As far as parallelism is concerned, the second approach, with transparent constructs, is commonly used to add parallelism to Scheme. However,srst-class continuations gave a hard time to resear... |

31 |
Obtaining coroutines with continuations
- Haynes, Friedman, et al.
- 1986
(Show Context)
Citation Context ... are useful to dene powerful control structures, such as escape mechanisms, abortion and resumption of computations, coroutines; several programming examples with continuations can be found in [14], [=-=15]-=-. As far as parallelism is concerned, the second approach, with transparent constructs, is commonly used to add parallelism to Scheme. However,srst-class continuations gave a hard time to researchers ... |

31 |
Speculative Computation in Multilisp
- Osborne
- 1990
(Show Context)
Citation Context ...ber of processes might be created: this raises the question of scheduling . We did not study this problem in this paper but some solutions have been previously suggested like the sponsors in [11] and [26]. 3 The Target Language: == We recall the reader that we intend to dene C by a translation to == . In Section 3.1, == is given a formal semantics, and some programming examples can be found i... |

25 |
Continuing into the future: on the interaction of futures and first-class continuations
- Katz, Weise
- 1990
(Show Context)
Citation Context ...oach, with transparent constructs, is commonly used to add parallelism to Scheme. However,srst-class continuations gave a hard time to researchers to dene a transparent future construct ([19], [16], [=-=18]-=-, [20], [11]). Sequential programs are characterised by asxed evaluation order (that we assume to be from left to right in this paper). This evaluation order does not exist any longer when parallel co... |

24 |
PFL: A functional language for parallel programming
- HolmstrÃ¶m
- 1983
(Show Context)
Citation Context ...s in adding to the language the notions of processes, channels, and communications as in calculi like CCS [21]. An operational semantics is given in [2] and several implementations were realised (PFL =-=[17]-=-, CML [32]). Its main drawbacks are that the language is no longer functional and that it requires another programming methodology to develop parallel applications. On the other hand, one can preserve... |

22 |
First-class synchronous operations in Standard ML
- Reppy
- 1989
(Show Context)
Citation Context ...g to the language the notions of processes, channels, and communications as in calculi like CCS [21]. An operational semantics is given in [2] and several implementations were realised (PFL [17], CML =-=[32]-=-). Its main drawbacks are that the language is no longer functional and that it requires another programming methodology to develop parallel applications. On the other hand, one can preserve the funct... |

21 | Design of a concurrent and distributed language
- Queinnec, DeRoure
- 1993
(Show Context)
Citation Context ...hough possibly greater than one. Our approach is totally opposite, we add constraints on continuations applications in order to ensure only one result, the same as in the sequential version. Queinnec =-=[30]-=- distinguishes multiplicative pcall from additive pcall. An expression (pcall M N) is multiplicative if all values of M are applied to all values of N (when M and N multiply return results). An expres... |

16 |
A Reduction Semantics for Imperative Higher-Order Languages
- Felleisen, Friedman
- 1987
(Show Context)
Citation Context ... is applied in the dynamic extent of the call/cc by which it was reied since all left expressions should have returned a value, even the ones outside the scope of the call/cc. Felleisen and Friedman [=-=-=-6] dene the operator F and they describe a parallel evaluation strategy but they impose the same constraints on the capture and the application of continuations. Hammond [12], [13] denes a semantics o... |

13 |
Parallel Symbolic Computing
- Halstead, R
- 1986
(Show Context)
Citation Context .... On the other hand, one can preserve the functional features of the language by adding constructs like future and pcall. These constructs were initially implemented in MultiLisp as described in [9], =-=[10]-=-. Such operators are said to be transparent since programs using them return the same results as their sequentialised versions (i.e. these programs where those operators were deleted). Thus, those par... |

7 |
Garbage collection in multischeme
- Miller, Epstein
- 1989
(Show Context)
Citation Context ...with transparent constructs, is commonly used to add parallelism to Scheme. However,srst-class continuations gave a hard time to researchers to dene a transparent future construct ([19], [16], [18], [=-=20]-=-, [11]). Sequential programs are characterised by asxed evaluation order (that we assume to be from left to right in this paper). This evaluation order does not exist any longer when parallel construc... |

5 | Sound Rules for Parallel Evaluation of a Functional Language with callcc
- Moreau, Ribbens
- 1993
(Show Context)
Citation Context ... initial continuation, is dened by i = (lambda (v) (send c0 v)). The value of an expression E is the value received on channel c0 in expression (13). 8 Properties of the Semantics In another paper [25], we dene the CPP-calculus as an extension of the call-by-value lambda-calculus [27] with a control operator call/cc. The CPP-calculus diers from Felleisen and Friedman's c -calculus [5], [7] beca... |

4 |
Exception handling in a parallel functional language: PSML
- Hammond
- 1989
(Show Context)
Citation Context .../cc. Felleisen and Friedman [6] dene the operator F and they describe a parallel evaluation strategy but they impose the same constraints on the capture and the application of continuations. Hammond [=-=12-=-], [13] denes a semantics of ML exceptions which can be preserved in a parallel implementation. If expression e 2 in application e 1 (e 2 ) returns an exception, it can only be raised if e 1 returns a... |

3 |
Scheme, A Language for Massively Parallel Machines
- Crystal
- 1991
(Show Context)
Citation Context ...sparent. Our approach is closer to delay/force operators for lazy evaluation, where the programmer has also to explicitly use force. 9 Related Work PolyScheme was initially proposed by Queinnec [28], =-=[29]-=-, from whom we borrowed the technique of symmetric continuations in Figure 9. In Figures 12, 13, and 14, we have added higher-order continuations to preserve the sequential semantics, and we have forc... |

2 |
Implementing a Parallel Functional Languages
- Hammond
- 1991
(Show Context)
Citation Context ...elleisen and Friedman [6] dene the operator F and they describe a parallel evaluation strategy but they impose the same constraints on the capture and the application of continuations. Hammond [12], [=-=13-=-] denes a semantics of ML exceptions which can be preserved in a parallel implementation. If expression e 2 in application e 1 (e 2 ) returns an exception, it can only be raised if e 1 returns a value... |

2 | An Operational Semantics for a Parallel Language with Continuations - Moreau - 1992 |

2 |
a Semantics for a Concurrent Scheme
- Polyscheme
- 1990
(Show Context)
Citation Context ...truct of == is used. In order to completely specify C , we still have to add translation rules for the parallel constructs pcall, fork, and future. Let us initially consider thesrst one. Queinnec [2=-=8-=-] gives a semantics for PolyScheme, a parallel dialect of Scheme. Let us use the same technique to dene the pcall operator for which a verbose translation can be found in Figure 8. For each applicatio... |

1 |
Programming in a Parallel Functional Language with Continuations (in French
- Moreau
- 1992
(Show Context)
Citation Context ...ured it: we apply a continuation if we know that it is legitimate. In [18], continuations are applied independently of the legitimacy testing. Nevertheless, in the coroutine-style examples we give in =-=[24]-=- and in Section 2.2, continuations are applied to transmit a result to a coroutine; thus, there is no point to transmit another result if it is not needed although the next result can be searched spec... |

1 |
Rabbit: a Compiler for Scheme. MIT AI Memo 474
- Steele
- 1978
(Show Context)
Citation Context ... proposed by Fisher [8] and Reynolds [33], and further investigated by Plotkin [27]. Such a style is often used for denotational semantics and for program transformations in compilers [3], [4], [34], =-=[35-=-], [1]. In our notation, a translation consists of a set of translation rules having the following pattern: [[Term]]=exp. The left-hand side of the rule is a source term of C in brackets and the righ... |

1 | Figure 17. Reduction rules for == List of Figures 1 Semantic objects 12 2 Reduction rules for == 13 3 De of a store 15 4 De of a semaphore 16 5 De of a sink and an emitter 18 6 Evaluation of an expression in == 19 7 Asymmetric continuation-passing styl - Moreau |