Results 1  10
of
26
Macros as multistage computations: Typesafe, generative, binding macros in MacroML
 in MacroML. In the International Conference on Functional Programming (ICFP â€™01
, 2001
"... ..."
Closed Types for a Safe Imperative MetaML
, 2001
"... This paper addresses the issue of safely combining computational eects and multistage programming. We propose a type system, which exploits a notion of closed type, to check statically that an imperative multistage program does not cause runtime errors. Our approach is demonstrated formally for a ..."
Abstract

Cited by 32 (11 self)
 Add to MetaCart
This paper addresses the issue of safely combining computational eects and multistage programming. We propose a type system, which exploits a notion of closed type, to check statically that an imperative multistage program does not cause runtime errors. Our approach is demonstrated formally for a core language called MiniML ref . This core language safely combines multistage constructs and MLstyle references, and is a conservative extension of MiniML ref , a simple imperative subset of SML. In previous work, we introduced a closed type constructor , which was enough to ensure the safe execution of dynamically generated code in the pure fragment of MiniML ref .
Two for the Price of One: Composing Partial Evaluation and Compilation
, 1997
"... One of the flagship applications of partial evaluation is compilation and compiler generation. However, partial evaluation is usually expressed as a sourcetosource transformation for highlevel languages, whereas realistic compilers produce object code. We close this gap by composing a partial eva ..."
Abstract

Cited by 21 (3 self)
 Add to MetaCart
One of the flagship applications of partial evaluation is compilation and compiler generation. However, partial evaluation is usually expressed as a sourcetosource transformation for highlevel languages, whereas realistic compilers produce object code. We close this gap by composing a partial evaluator with a compiler by automatic means. Our work is a successful application of several metacomputation techniques to build the system, both in theory and in practice. The composition is an application of deforestation or fusion. The result is a runtime code generation system built from existing components. Its applications are numerous. For example, it allows the language designer to perform interpreterbased experiments with a sourcetosource version of the partial evaluator before building a realistic compiler which generates object code automatically.
A Hybrid Approach to Online and Offline Partial Evaluation
 HigherOrder and Symbolic Computation
, 2002
"... This article presents a hybrid method of partial evaluation (PE), which is exactly as precise as naive online PE and nearly as efficient as stateoftheart offline PE, for a statically typed callbyvalue functional language. ..."
Abstract

Cited by 16 (0 self)
 Add to MetaCart
This article presents a hybrid method of partial evaluation (PE), which is exactly as precise as naive online PE and nearly as efficient as stateoftheart offline PE, for a statically typed callbyvalue functional language.
A Monadic Multistage Metalanguage
, 2003
"... We describe a metalanguage MMML, which makes explicit the order of evaluation (in the spirit of monadic metalanguages) and the staging of computations (as in languages for multilevel bindingtime analysis). The main contribution of the paper is an operational semantics which is sufficiently detaile ..."
Abstract

Cited by 15 (7 self)
 Add to MetaCart
We describe a metalanguage MMML, which makes explicit the order of evaluation (in the spirit of monadic metalanguages) and the staging of computations (as in languages for multilevel bindingtime analysis). The main contribution of the paper is an operational semantics which is sufficiently detailed for analyzing subtle aspects of multistage programming, but also intuitive enough to serve as a reference semantics. For instance, the separation of computational types from code types, makes clear the distinction between a computation for generating code and the generated code, and provides a basis for multilingual extensions, where a variety of programming languages (aka monads) coexist. The operational semantics consists of two parts: local (semantics preserving) simplification rules, and computation steps executed in a deterministic order (because they may have sideeffects). We focus on the computational aspects, thus we adopt a simple type system, that can detect usual type errors, but not the unresolved link errors. Because of its explicit annotations, MMML is suitable as an intermediate language.
Sound Specialization in the Presence of Computational Effects
 In Theoretical Aspects of Computer Software
, 1997
"... Moggi's computational lambda calculus c is a wellestablished model of computation. We define a twolevel version c of the computational lambda calculus and demonstrate that it is an inevitable description for sound specialization. We implement the calculus in terms of a standard twolevel lam ..."
Abstract

Cited by 14 (5 self)
 Add to MetaCart
Moggi's computational lambda calculus c is a wellestablished model of computation. We define a twolevel version c of the computational lambda calculus and demonstrate that it is an inevitable description for sound specialization. We implement the calculus in terms of a standard twolevel lambda calculus via a continuationpassing style transformation. This transformation is sound and complete with respect to c ; it forms a reflection in the twolevel lambda calculus of c . As a practical ramification of this work we show that several published specialization algorithms are unsound and develop a sound specializer similar to continuationbased specializers. Keywords: lambda calculus, partial evaluation, functional programming, continuations. 1 Introduction What is a correct partial evaluator for the lambda calculus? Most of the work addressing this question has focused on the relationship between the bindingtime analysis and the specializer [20, 21, 23,30,32,38] using a variety of ...
Optimizing data structures in highlevel programs: New directions for extensible compilers based on staging
 In POPL
, 2013
"... High level data structures are a cornerstone of modern programming and at the same time stand in the way of compiler optimizations. In order to reason about user or librarydefined data structures, compilers need to be extensible. Common mechanisms to extend compilers fall into two categories. Front ..."
Abstract

Cited by 10 (3 self)
 Add to MetaCart
High level data structures are a cornerstone of modern programming and at the same time stand in the way of compiler optimizations. In order to reason about user or librarydefined data structures, compilers need to be extensible. Common mechanisms to extend compilers fall into two categories. Frontend macros, staging or partial evaluation systems can be used to programmatically remove abstraction and specialize programs before they enter the compiler. Alternatively, some compilers allow extending the internal workings by adding new transformation passes at different points in the compile chain or adding new intermediate representation (IR) types. None of these mechanisms alone is sufficient to handle the challenges posed by high level data structures. This paper shows a novel way to combine them to yield benefits that are greater than the sum of the parts.
Shifting the Stage  Staging with Delimited Control
, 2009
"... It is often hard to write programs that are efficient yet reusable. For example, an efficient implementation of Gaussian elimination should be specialized to the structure and known static properties of the input matrix. The most profitable optimizations, such as choosing the best pivoting or memoiz ..."
Abstract

Cited by 9 (5 self)
 Add to MetaCart
It is often hard to write programs that are efficient yet reusable. For example, an efficient implementation of Gaussian elimination should be specialized to the structure and known static properties of the input matrix. The most profitable optimizations, such as choosing the best pivoting or memoization, cannot be expected of even an advanced compiler because they are specific to the domain, but expressing these optimizations directly makes for ungainly source code. Instead, a promising and popular way to reconcile efficiency with reusability is for a domain expert to write code generators. Two pillars of this approach are types and effects. Typed multilevel languages such as MetaOCaml ensure safety: a welltyped code generator neither goes wrong nor generates code that goes wrong. Side effects such as state and control ease correctness: an effectful generator can resemble the textbook presentation of an algorithm, as is familiar to domain experts, yet insert let for memoization and if for boundschecking, as is necessary for efficiency. However, adding effects blindly renders multilevel types unsound. We introduce the first twolevel calculus with control effects and a sound type system. We give smallstep operational semantics as well as a continuationpassing style (CPS) translation. For soundness, our calculus restricts the code generatorâ€™s effects to the scope of generated binders. Even with this restriction, we can finally write efficient code generators for dynamic programming and numerical methods in direct style, like in algorithm textbooks, rather than in CPS or monadic style.
Type Specialisation for Imperative Languages
 PROC. INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING
, 1997
"... We extend type specialisation to a computational lambda calculus with firstclass references. The resulting specialiser has been used to specialise a selfinterpreter for this typed computational lambda calculus optimally. Furthermore, this specialiser can perform operations on references at special ..."
Abstract

Cited by 9 (6 self)
 Add to MetaCart
We extend type specialisation to a computational lambda calculus with firstclass references. The resulting specialiser has been used to specialise a selfinterpreter for this typed computational lambda calculus optimally. Furthermore, this specialiser can perform operations on references at specialisation time, when possible.
Correctness of a RegionBased BindingTime Analysis
 Carnegie Mellon University, Elsevier Science BV
, 1997
"... A bindingtime analysis is the first pass of an offline partial evaluator. It determines which parts of a program may be executed at specialization time. Regionbased bindingtime analysis applies to higherorder programming languages with firstclass references. The consideration of effects in the d ..."
Abstract

Cited by 6 (5 self)
 Add to MetaCart
A bindingtime analysis is the first pass of an offline partial evaluator. It determines which parts of a program may be executed at specialization time. Regionbased bindingtime analysis applies to higherorder programming languages with firstclass references. The consideration of effects in the determination of binding time properties makes it possible to have a partial evaluator perform assignments at specialization time. We present such a regionbased bindingtime analysis and prove its correctness with respect to a continuationstyle semantics for an annotated callbyvalue lambda calculus with MLstyle references. We provide a relative correctness proof that relies on the correctness of region inference and on the correctness of a bindingtime analysis for an applied lambda calculus. The main tool in the proof is a translation from terms with explicit region annotations to an extended continuationpassing storepassing style. The analysis is monovariant/monomorphic, however, ess...