A powerful strategy for deriving efficient programs by transformation

  • Authors:
  • Alberto Pettorossi

  • Affiliations:
  • -

  • Venue:
  • LFP '84 Proceedings of the 1984 ACM Symposium on LISP and functional programming
  • Year:
  • 1984

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present a method for deriving efficient iterative programs by transformation from recursive equation specifications. It consists of two phases: i) the transformation of general recursive programs into linear recursive ones, and ii) the transformation of linear recursive programs into iterative ones. In the first phase we apply the “tupling strategy” studied in [BUD77, Pet77], and implicitly used by other authors in the area of program transformation. That strategy enables us to introduce linear recursive functions, instead of the general recursive ones occurring in program specifications. In the second phase we apply known methods for transforming linear recursion into iteration (avoiding the use of stacks) [WaS73], and equivalence results between recursive schemas and flowchart schemas. Through various examples we show how the breaking of the transformation process into the above mentioned phases allows the derivation of efficient iterative algorithms. Those examples include challenges by Prof. E. Dijkstra and other authors. Through our method we were also able to improve some recent results for eliminating redundant calls in recursive programs [Coh83].