Program Transformation Techniques in Program Generation
暂无分享,去创建一个
Abstract : Automatic removal of intermediate structures has been an exciting possibility for a long time, holding a promise of the best of two worlds: programming with explicit intermediate structures enables concise and modular solution to problems; and the removal of the structures provides efficient run-time implementations. One particularly effective technique is called the fold-build rule. The rule exploits a convergence of three programming aspects, structured iteration, function abstraction, and parametricity, to achieve intermediate structure removal in a single transformation step. One shortcoming of the technique is that, up to now, it has not been clear how to fuse zip. The purpose of this paper is to extend the fold-build technique, showing how both branches of zip can be fused concurrently. The paper is organized as follows. We review the fold-build technique, then we introduce a new form of fold that enables coroutining, and show how this provides a solution to the zip problem. Then we present alternative models for coroutining folds, discuss implementation, and demonstrate full fusion. Finally, we give axiomatization for an abstract type that unifies the various models and we initiate a study of the abstract type that we hope will lead to a proof of correctness of the new fusion algorithm.
[1] Simon L. Peyton Jones,et al. A short cut to deforestation , 1993, FPCA '93.
[2] John Hughes,et al. Generalising monads to arrows , 2000, Sci. Comput. Program..
[3] John Launchbury,et al. Parametricity and Unboxing with Unpointed Types , 1996, ESOP.
[4] John Launchbury,et al. Warm fusion: deriving build-catas from recursive definitions , 1995, FPCA '95.
[5] Andrew John Gill,et al. Cheap deforestation for non-strict functional languages , 1996 .