Efficient compilation of linear recursive functions into object level loops

  • Authors:
  • Peter Harrison;Hessam Khoshnevisan

  • Affiliations:
  • Univ. of London, London, UK;Univ. of London, London, UK

  • Venue:
  • SIGPLAN '86 Proceedings of the 1986 SIGPLAN symposium on Compiler construction
  • Year:
  • 1986

Quantified Score

Hi-index 0.00

Visualization

Abstract

Whilst widely recognised as an excellent means for solving problems and for designing software, functional programming languages have suffered from their inefficient implementations on conventional computers. A route to improved runtime performance is to transform recursively defined functions into programs which execute more quickly and/or consume less space. We derive equivalent imperative programming language loops for a large class of linear recursive functions of which the tail-recursive functions form a very small subset. We first identify a small set of primitive function defining expressions for which we determine the corresponding loop-expressions. We then determine the loop-expressions for linear functions defined by any expressions which are formed from those primitives. In this way, a very general class of linear functions can be transformed automatically into loops in the parsing phase of a compiler, since the parser has in any case to determine the hierarchical structure of function definitions. Further transformation may involve specific properties of particular defining expressions, and adopt previous schemes. In addition, equivalent linear functions can be found for many non-linear ones which can therefore also be transformed into loops.