230,991 research outputs found
A Rational Deconstruction of Landin's SECD Machine with the J Operator
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
Lazy Evaluation and Delimited Control
The call-by-need lambda calculus provides an equational framework for
reasoning syntactically about lazy evaluation. This paper examines its
operational characteristics. By a series of reasoning steps, we systematically
unpack the standard-order reduction relation of the calculus and discover a
novel abstract machine definition which, like the calculus, goes "under
lambdas." We prove that machine evaluation is equivalent to standard-order
evaluation. Unlike traditional abstract machines, delimited control plays a
significant role in the machine's behavior. In particular, the machine replaces
the manipulation of a heap using store-based effects with disciplined
management of the evaluation stack using control-based effects. In short, state
is replaced with control. To further articulate this observation, we present a
simulation of call-by-need in a call-by-value language using delimited control
operations
Classical logic, continuation semantics and abstract machines
One of the goals of this paper is to demonstrate that denotational semantics is useful for operational issues like implementation of functional languages by abstract machines. This is exemplified in a tutorial way by studying the case of extensional untyped call-by-name λ-calculus with Felleisen's control operator 𝒞. We derive the transition rules for an abstract machine from a continuation semantics which appears as a generalization of the ¬¬-translation known from logic. The resulting abstract machine appears as an extension of Krivine's machine implementing head reduction. Though the result, namely Krivine's machine, is well known our method of deriving it from continuation semantics is new and applicable to other languages (as e.g. call-by-value variants). Further new results are that Scott's D∞-models are all instances of continuation models. Moreover, we extend our continuation semantics to Parigot's λμ-calculus from which we derive an extension of Krivine's machine for λμ-calculus. The relation between continuation semantics and the abstract machines is made precise by proving computational adequacy results employing an elegant method introduced by Pitts
Answer-Type Modification without Tears: Prompt-Passing Style Translation for Typed Delimited-Control Operators
The salient feature of delimited-control operators is their ability to modify
answer types during computation. The feature, answer-type modification (ATM for
short), allows one to express various interesting programs such as typed printf
compactly and nicely, while it makes it difficult to embed these operators in
standard functional languages.
In this paper, we present a typed translation of delimited-control operators
shift and reset with ATM into a familiar language with multi-prompt shift and
reset without ATM, which lets us use ATM in standard languages without
modifying the type system. Our translation generalizes Kiselyov's direct-style
implementation of typed printf, which uses two prompts to emulate the
modification of answer types, and passes them during computation. We prove that
our translation preserves typing. As the naive prompt-passing style translation
generates and passes many prompts even for pure terms, we show an optimized
translation that generate prompts only when needed, which is also
type-preserving. Finally, we give an implementation in the tagless-final style
which respects typing by construction.Comment: In Proceedings WoC 2015, arXiv:1606.0583
Scope ambiguities, monads and strengths
In this paper, we will discuss three semantically distinct scope assignment
strategies: traditional movement strategy, polyadic approach, and
continuation-based approach. As a generalized quantifier on a set X is an
element of C(X), the value of continuation monad C on X, in all three
approaches QPs are interpreted as C-computations. The main goal of this paper
is to relate the three strategies to the computational machinery connected to
the monad C (strength and derived operations). As will be shown, both the
polyadic approach and the continuation-based approach make heavy use of monad
constructs. In the traditional movement strategy, monad constructs are not used
but we still need them to explain how the three strategies are related and what
can be expected of them wrt handling scopal ambiguities in simple sentences.Comment: 47 pages, small correction
- …