Generating Function Versions with Rational Strictness Patterns

Abstract Expression evaluation in lazy applicative languages is usually implemented by an expensive mechanism requiring time and space which may be wasted if the expression eventually needs the values anyway. Strictness analysis, which has been successfully applied to flat domains and higher order functions, is used here to annotate programs in a first order language containing lazy list constructors so that they retain their original behavior, but run more efficiently. In practice, the strictness in fields within these constructors often follows regular patterns that can be finitely represented, especially in programs that manipulate such useful structures as finite or infinite trees. The approach presented here typically generates efficient, mutually recursive function versions for these programs. Weak and strong safety are defined and discussed, and the compiler is shown to be weakly safe. Termination is guaranteed by several factors, including a finite resource which controls the increase in code size, and a regularity constraint placed upon the strictness patterns propagated during compilation.

[1]  Daniel P. Friedman,et al.  CONS Should Not Evaluate its Arguments , 1976, ICALP.

[2]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[3]  Paul Hudak,et al.  Higher-order strictness analysis in untyped lambda calculus , 1986, POPL '86.

[4]  Samson Abramsky,et al.  Strictness analysis and polymorphic invariance , 1985, Programs as Data Objects.

[5]  Flemming Nielson,et al.  Strictness analysis and denotational abstract interpretation , 1987, POPL '87.

[6]  Joseph E. Stoy,et al.  Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory , 1981 .

[7]  S. C. Wray Implementation and programming techniques for functional languages , 1986 .

[8]  Steven D. Johnson Synthesis of digital designs from recursion equations , 1983 .

[9]  Gary Lindstrom Static evaluation of functional programs , 1986, SIGPLAN '86.

[10]  Tsung-Min Kuo,et al.  On strictness and its analysis , 1987, POPL '87.

[11]  P. J. Landin,et al.  Correspondence between ALGOL 60 and Church's Lambda-notation , 1965, Commun. ACM.

[12]  Philip Wadler,et al.  Projections for strictness analysis , 1987, FPCA.

[13]  Lennart Augustsson,et al.  A compiler for lazy ML , 1984, LFP '84.

[14]  Cordelia V. Hall Strictness analysis applied to programs with lazy list constructors , 1987 .

[15]  John Hughes,et al.  Strictness detection in non-flat domains , 1985, Programs as Data Objects.

[16]  J. Fairbairn,et al.  Ponder and its type system , 1982 .

[17]  Jon Fairbairn,et al.  Code generation techniques for functional languages , 1986, LFP '86.

[18]  Cordelia V. Hall,et al.  Compiling strictness into streams , 1987, POPL '87.

[19]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.

[20]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .

[21]  Gerald J. Sussman,et al.  Structure and interpretation of computer programs , 1985, Proceedings of the IEEE.

[22]  Paul Hudak,et al.  Variations on strictness analysis , 1986, LFP '86.

[23]  Chris Hankin,et al.  Strictness Analysis for Higher-Order Functions , 1986, Sci. Comput. Program..