33 research outputs found
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
A continuation semantics of interrogatives that accounts for Baker's ambiguity
Wh-phrases in English can appear both raised and in-situ. However, only
in-situ wh-phrases can take semantic scope beyond the immediately enclosing
clause. I present a denotational semantics of interrogatives that naturally
accounts for these two properties. It neither invokes movement or economy, nor
posits lexical ambiguity between raised and in-situ occurrences of the same
wh-phrase. My analysis is based on the concept of continuations. It uses a
novel type system for higher-order continuations to handle wide-scope
wh-phrases while remaining strictly compositional. This treatment sheds light
on the combinatorics of interrogatives as well as other kinds of so-called
A'-movement.Comment: 20 pages; typo fixe
Lazy Stream Programming in Prolog
In recent years, stream processing has become a prominent approach for
incrementally handling large amounts of data, with special support and
libraries in many programming languages. Unfortunately, support in Prolog has
so far been lacking and most existing approaches are ad-hoc. To remedy this
situation, we present lazy stream generators as a unified Prolog interface for
stateful computations on both finite and infinite sequences of data that are
produced incrementally through I/O and/or algorithmically.
We expose stream generators to the application programmer in two ways: 1)
through an abstract sequence manipulation API, convenient for defining custom
generators, and 2) as idiomatic lazy lists, compatible with many existing list
predicates. We define an algebra of stream generator operations that extends
Prolog via an embedded language interpreter, provides a compact notation for
composing generators and supports moving between the two isomorphic
representations.
As a special instance, we introduce answer stream generators that encapsulate
the work of coroutining first-class logic engines and support interoperation
between forward recursive AND-streams and backtracking-generated OR-streams.
Keywords: lazy stream generators, lazy lists, first-class logic engines,
stream combinators, AND-stream / OR-stream interoperation, Prolog extensionsComment: In Proceedings ICLP 2019, arXiv:1909.0764
Continuations for Comparatives
I extend Barker and Shan\u27s (2014) project of finding natural language applications for continuations to another domain in which it is useful, namely comparatives. I introduce existing analyses of comparatives, in particular Heim 2000, 2006, and Schwarzschild and Wilkinson 2002 and then demonstrate how these analyses can be implemented in the continuations framework
An Operational Foundation for Delimited Continuations
We derive an abstract machine that corresponds to a definitional interpreter for the control operators shift and reset. Based on this abstract machine, we construct a syntactic theory of delimited continuations. Both the derivation and the construction scale to the family of control operators shift_n and reset_n. The definitional interpreter for shift_n and reset_n has n + 1 layers of continuations, the corresponding abstract machine has n + 1 layers of control stacks, and the corresponding syntactic theory has n + 1 layers of evaluation contexts.See also BRICS-RS-05-24