Results 1  10
of
18
Program Analysis and Specialization for the C Programming Language
, 1994
"... Software engineers are faced with a dilemma. They want to write general and wellstructured programs that are flexible and easy to maintain. On the other hand, generality has a price: efficiency. A specialized program solving a particular problem is often significantly faster than a general program. ..."
Abstract

Cited by 628 (0 self)
 Add to MetaCart
Software engineers are faced with a dilemma. They want to write general and wellstructured programs that are flexible and easy to maintain. On the other hand, generality has a price: efficiency. A specialized program solving a particular problem is often significantly faster than a general program. However, the development of specialized software is timeconsuming, and is likely to exceed the production of today’s programmers. New techniques are required to solve this socalled software crisis. Partial evaluation is a program specialization technique that reconciles the benefits of generality with efficiency. This thesis presents an automatic partial evaluator for the Ansi C programming language. The content of this thesis is analysis and transformation of C programs. We develop several analyses that support the transformation of a program into its generating extension. A generating extension is a program that produces specialized programs when executed on parts of the input. The thesis contains the following main results.
Rules and Strategies for Transforming Functional and Logic Programs
 ACM Computing Surveys
, 1996
"... We present an overview of the program transformation methodology, focusing our attention on the socalled `rules + strategies' approach in the case of functional and logic programs. The paper is intended to offer an introduction to the subject. The various techniques we present are illustrated ..."
Abstract

Cited by 85 (5 self)
 Add to MetaCart
We present an overview of the program transformation methodology, focusing our attention on the socalled `rules + strategies' approach in the case of functional and logic programs. The paper is intended to offer an introduction to the subject. The various techniques we present are illustrated via simple examples. A preliminary version of this report has been published in: Moller, B., Partsch, H., and Schuman, S. (eds.): Formal Program Development. Lecture Notes in Computer Science 755, Springer Verlag (1993) 263304. Also published in: ACM Computing Surveys, Vol 28, No. 2, June 1996. 3 1 Introduction The program transformation approach to the development of programs has first been advocated by [BurstallDarlington 77], although the basic ideas were already presented in previous papers by the same authors [Darlington 72, BurstallDarlington 75]. In that approach the task of writing a correct and efficient program is realized in two phases: the first phase consists in writing an in...
Finally Tagless, Partially Evaluated  Tagless Staged Interpreters for Simpler Typed Languages
 UNDER CONSIDERATION FOR PUBLICATION IN J. FUNCTIONAL PROGRAMMING
"... We have built the first family of tagless interpretations for a higherorder typed object language in a typed metalanguage (Haskell or ML) that require no dependent types, generalized algebraic data types, or postprocessing to eliminate tags. The statically typepreserving interpretations include an ..."
Abstract

Cited by 53 (9 self)
 Add to MetaCart
We have built the first family of tagless interpretations for a higherorder typed object language in a typed metalanguage (Haskell or ML) that require no dependent types, generalized algebraic data types, or postprocessing to eliminate tags. The statically typepreserving interpretations include an evaluator, a compiler (or staged evaluator), a partial evaluator, and callbyname and callbyvalue CPS transformers. Our principal technique is to encode de Bruijn or higherorder abstract syntax using combinator functions rather than data constructors. In other words, we represent object terms not in an initial algebra but using the coalgebraic structure of the λcalculus. Our representation also simulates inductive maps from types to types, which are required for typed partial evaluation and CPS transformations. Our encoding of an object term abstracts uniformly over the family of ways to interpret it, yet statically assures that the interpreters never get stuck. This family of interpreters thus demonstrates again that it is useful to abstract over higherkinded types.
Efficient analyses for realistic offline partial evaluation
 Journal of Functional Programming
, 1993
"... Based on Henglein’s efficient bindingtime analysis for the lambda calculus (with constants and “fix”) [Hen91], we develop four efficient analyses for use in the preprocessing phase of Similix, a selfapplicable partial evaluator for a higherorder subset of Scheme. The analyses developed in this pa ..."
Abstract

Cited by 49 (1 self)
 Add to MetaCart
Based on Henglein’s efficient bindingtime analysis for the lambda calculus (with constants and “fix”) [Hen91], we develop four efficient analyses for use in the preprocessing phase of Similix, a selfapplicable partial evaluator for a higherorder subset of Scheme. The analyses developed in this paper are almostlinear in the size of the analysed program. (1) A flow analysis determines possible value flow between lambdaabstractions and function applications and between constructor applications and selector/predicate applications. The flow analysis is not particularly biased towards partial evaluation; the analysis corresponds to the closure analysis of [Bon91b]. (2) A (monovariant) bindingtime analysis distinguishes static from dynamic values; the analysis treats both higherorder functions and partially static data structures. (3) A new isused analysis, not present in [Bon91b], finds a nonminimal bindingtime annotation which is “safe ” in a certain way: a firstorder value may only become static if its result is “needed ” during specialization; this “poor man’s generalization ” [Hol88] increases termination of specialization. (4) Finally, an evaluationorder dependency analysis ensures that the order of sideeffects is preserved in the residual program. The four analyses are performed
BindingTime Analysis and the Taming of C Pointers
"... The aim of bindingtime analysis is to determine when variables, expressions, statements, etc. in a program can be evaluated by classifying these into static (compiletime) and dyamic (runtime). Explicit separation of binding times has turned out to be crucial for successful selfapplication of par ..."
Abstract

Cited by 35 (1 self)
 Add to MetaCart
The aim of bindingtime analysis is to determine when variables, expressions, statements, etc. in a program can be evaluated by classifying these into static (compiletime) and dyamic (runtime). Explicit separation of binding times has turned out to be crucial for successful selfapplication of partial evaluators, and apparently, it is also an important steppingstone for profitable specialization of imperative languages with pointers and dynamic memory allocation. In this paper we present an automatic bindingtime analysis for a substantial subset of the C language. The paper has two parts. In the first part, the semantic issues of bindingtime separation is discussed with emphasis on pointers and classification of these. This leads to the introduction of a twolevel C language where binding times are explicit in the syntax. Finally, wellannotatedness rules are given which excludes nonconsistently annotated programs. In the second part, an automatic bindingtime analysis based on constraint system solving is developed. The constraints capture the bindingtime dependencies between expressions and subexpressions, and a solution to the system gives the binding times of all variables and expressions. We give rules for the generation of constraints, provide normalization rules, and describe how a solution can be found. Given the binding times of expressions, a wellannotated twolevel version of the program can easily be construted. A twolevel program can e.g. be input to an offline partial evaluator.
Handwriting program generator generators
 Sixth International Symposium on Programming Language Implementation and Logic Programming, number 844 in Lecture Notes in Computer Science
, 1994
"... Abstract. In this paper we argue that handwriting a program generator generator has a number of advantages compared to generating a program generator generator by selfapplication of a partial evaluator. We show the basic principles of how to construct a program generator generator by presenting a ..."
Abstract

Cited by 32 (0 self)
 Add to MetaCart
(Show Context)
Abstract. In this paper we argue that handwriting a program generator generator has a number of advantages compared to generating a program generator generator by selfapplication of a partial evaluator. We show the basic principles of how to construct a program generator generator by presenting a program generator generator for a skeletal language, and we argue that it is not more difficult to use the direct approach than the indirect approach. Moreover, we report on some promising experiments made with a prototype implementation of a program generator generator for most of the Standard ML Core Language. To the best of our knowledge, our prototype is the first succesfully implemented handwritten program generator generator for a statically typed language. 1
A Provably Correct Compiler Generator
 IN PROC. ESOP’92, SPRINGERVERLAG (LNCS 582), PAGES 418–434
, 1992
"... We have designed, implemented, and proved the correctness of a compiler generator that accepts action semantic descriptions of imperative programming languages. The generated compilers emit absolute code for an abstract RISC machine language that currently is assembled into code for the SPARC and th ..."
Abstract

Cited by 29 (3 self)
 Add to MetaCart
We have designed, implemented, and proved the correctness of a compiler generator that accepts action semantic descriptions of imperative programming languages. The generated compilers emit absolute code for an abstract RISC machine language that currently is assembled into code for the SPARC and the HP Precision Architecture. Our machine language needs no runtime typechecking and is thus more realistic than those considered in previous compiler proofs. We use solely algebraic specifications; proofs are given in the initial model.
C Program Specialization
, 1992
"... Automatic program specialization has numerous application areas ranging from specialization of scientific computation to automatic compiler generation. During the last decade, several automatic partial evaluators have been developed and demonstrated their usefulness. However, none of these have both ..."
Abstract

Cited by 19 (4 self)
 Add to MetaCart
Automatic program specialization has numerous application areas ranging from specialization of scientific computation to automatic compiler generation. During the last decade, several automatic partial evaluators have been developed and demonstrated their usefulness. However, none of these have both been for a typed imperative language and selfapplicable. The main content of this thesis is the development of an automatic selfapplicable program specializer for a substantial subset of the C programming language. The use of an imperative language introduce many problems not present in partial evaluation of functional languages. New problems addressed and solved in this thesis includes handling of static sideeffects under dynamic control, treatment of the imperative data structures arrays and structures, partially static data structures and specialization time splitting of these, and representation of values and programs for efficient selfapplication. In the thesis we recall the founda...
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 16 (7 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.
A Theory of Program Refinement
, 1998
"... We give a canonical program refinement calculus based on the lambda calculus and classical firstorder predicate logic, and study its proof theory and semantics. The intention is to construct a metalanguage for refinement in which basic principles of program development can be studied. The idea is t ..."
Abstract

Cited by 7 (1 self)
 Add to MetaCart
(Show Context)
We give a canonical program refinement calculus based on the lambda calculus and classical firstorder predicate logic, and study its proof theory and semantics. The intention is to construct a metalanguage for refinement in which basic principles of program development can be studied. The idea is that it should be possible to induce a refinement calculus in a generic manner from a programming language and a program logic. For concreteness, we adopt the simplytyped lambda calculus augmented with primitive recursion as a paradigmatic typed functional programming language, and use classical firstorder logic as a simple program logic. A key feature is the construction of the refinement calculus in a modular fashion, as the combination of two orthogonal extensions to the underlying programming language (in this case, the simplytyped lambda calculus). The crucial observation is that a refinement calculus is given by extending a programming language to allow indeterminate expressions (or ‘stubs’) involving the construction ‘some program x such that P ’. Factoring this into ‘some x...’