Hostname: page-component-848d4c4894-pjpqr Total loading time: 0 Render date: 2024-07-03T04:59:15.341Z Has data issue: false hasContentIssue false

Using transformations in the implementation of higher-order functions

Published online by Cambridge University Press:  07 November 2008

Hanne Riis Nielson
Affiliation:
Computer Science Department, Aarhus University, Denmark
Flemming Nielson
Affiliation:
Computer Science Department, Aarhus University, Denmark
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Traditional functional languages do not have an explicit distinction between binding times. It arises implicitly, however, as one typically instantiates a higher-order function with the arguments that are known, whereas the unknown arguments remain to be taken as parameters. The distinction between ‘known’ and ‘unknown’ is closely related to the distinction between binding times like ‘compile-time’ and ‘run-time’. This leads to the use of a combination of polymorphic type inference and binding time analysis for obtaining the required information about which arguments are known.

Following the current trend in the implementation of functional languages we then transform the run-time level of the program (not the compile-time level) into categorical combinators. At this stage we have a natural distinction between two kinds of program transformations: partial evaluation, which involves the compile-time level of our notation, and algebraic transformations (i.e., the application of algebraic laws), which involves the run-time level of our notation.

By reinterpreting the combinators in suitable ways we obtain specifications of abstract interpretations (or data flow analyses). In particular, the use of combinators makes it possible to use a general framework for specifying both forward and backward analyses. The results of these analyses will be used to enable program transformations that are not applicable under all circumstances.

Finally, the combinators can also be reinterpreted to specify code generation for various (abstract) machines. To improve the efficiency of the code generated, one may apply abstract interpretations to collect extra information for guiding the code generation. Peephole optimizations may be used to improve the code at the lowest level.

Type
Articles
Copyright
Copyright © Cambridge University Press 1991

References

Aho, A. V., Sethi, R. and Ullman, J. D. 1986. Compilers – Principles, Techniques and Tools. Addison-Wesley.Google Scholar
Backus, J. 1978. Can Programming be Liberated from the von Neumann Style? A Functional Style and its Algebra of Programs. Commun. ACM 21.CrossRefGoogle Scholar
Bellegarde, B. 1986. Rewriting systems on FP expressions to reduce the number of sequences yielded. Sci. Comput. Programming 6.CrossRefGoogle Scholar
Bjerner, B. and Holmström, S. 1989. A compositional approach to time analysis of first order lazy functional programs. Proc. Functional Programming Languages and Comput. Architectures. ACM Press.Google Scholar
Burn, G. L., Hankin, C. and Abramsky, S. 1986. Strictness analysis for higher-order functions. Sci. of Comput. Programming 7.CrossRefGoogle Scholar
Burn, G. L. 1987. Evaluation transformers – a model for the parallel evaluation of functional languages. Proc. Functional Programming Languages and Comput. Architectures Conf. Volume 274 of Lecture Notes in Computer Sciences. Springer-Verlag.Google Scholar
Burstall, R. M. and Darlington, J. 1977. A transformation system for developing recursive programs. J. ACM 24.CrossRefGoogle Scholar
Cardelli, C. 1983. The functional abstract machine. Bell Labs. Technical Report TR-107.Google Scholar
Cousineau, G., Curien, P.-L. and Mauny, M. 1987. The categorical abstract machine. Sci. Comput. Programming 8.CrossRefGoogle Scholar
Curien, P.-L. 1986. Categorical Combinators, Sequential Algorithms and Functional Programming. Pitman.Google Scholar
Damas, L. 1985. Type assignment in programming languages. PhD Thesis CST-33-85, University of Edinburgh, Scotland.Google Scholar
Darlington, J. and Pull, H. 1988. A program development methodology based on a unified approach to execution and transformation. In Bjørner, D. et al. (editors), Partial Evaluation and Mixed Computation. North-Holland.Google Scholar
Despeyroux, J. 1986. Proof of translation in natural semantics. Symposium on Logic in Computer Science.IEEE Computer Society Press.Google Scholar
Ershov, A. P. 1982. Mixed computation: potential applications and problems for study. Theor. Comput. Sci. 18.CrossRefGoogle Scholar
Feather, M. S. 1982. A system for assisting program transformation. ACM Trans. Programming Languages and Systems 4.CrossRefGoogle Scholar
Harrison, P. G. 1988. Linearisation: an optimisation for nonlinear functional programs. Sci. of Comput. Programming 10.CrossRefGoogle Scholar
Hughes, J. 1982. Supercombinators: a new implementation method for applicative languages. Proc. 1982 ACM Conf. on LISP and Functional Programming.ACM Press.CrossRefGoogle Scholar
Hughes, J. 1986. Strictness detection in non-flat domains. Proc. Programs as Data Objects, Volume 217 of Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Hughes, J. 1988. Backwards analysis of functional programs. In Bjørner, D. et al. (editors), Partial Evaluation and Mixed Computation. North-Holland.Google Scholar
Hudak, P. and Young, J. 1988. A collecting interpretation of expressions (without powerdomains). Proc. 15th ACM Symposium on Principles of Programming LanguagesACM Press.CrossRefGoogle Scholar
Jones, N. D., Sestoft, P. and Søndergaard, H. 1985. An experiment in partial evaluation: the generation of a compiler generator. Proc. Rewriting Techniques and Applications. Volume 202 of Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Jørring, U. and Scherlis, W. L. 1986. Compilers and staging transformations. Proc. 13th ACM Symposium on Principles of Programming Languages.ACM Press.CrossRefGoogle Scholar
Lambek, J. and Scott, P. J. 1986. Introduction to Higher Order Categorical Logic. Cambridge Studies in Advanced Mathematics 7. Cambridge University Press.Google Scholar
Milner, R. 1984. The standard ML core language. Proc. ACM Conference on LISP and Functional Programming.ACM Press.Google Scholar
Milner, R. 1978. A theory of type polymorphism in programming. J. Comput. Systems 17.Google Scholar
Mogensen, T. 1989. Binding time analysis for higher order polymorphically typed languages. TAPSOFT 1989, Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Montenyohl, M. and Wand, M. 1988. Correct flow analysis in continuation semantics. Proc. 15th ACM Symposium on Principles of Programming Languages.ACM Press.CrossRefGoogle Scholar
Mycroft, A. 1981. Abstract interpretation and optimizing transformations for applicative programs. PhD Thesis CTS-15-81, University of Edinburgh, Scotland.Google Scholar
Mycroft, A. 1980. The theory and practice of transforming call-by-need into call-by-value. Proc. 4th International Symposium on Programming. Volume 83 of Lectures Notes in Computer Science. Springer-Verlag.CrossRefGoogle Scholar
Mycroft, A. and Nielson, F. 1983. Strong abstract interpretation using powerdomains. Proc. ICALP 1983. Volume 154 of Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Nielson, F. 1985. Program transformations in a denotational setting. ACM Trans. Programming Languages and Systems 7.CrossRefGoogle Scholar
Nielson, H. R. and Nielson, F. 1986. Semantics directed compiling for functional languages. Proc. ACM Conf. on LISP and Functional Programming.ACM Press.CrossRefGoogle Scholar
Nielson, F. 1987 a. Towards a denotational theory of abstract interpretation. In Abramsky, S. and Hankin, C. (editors), Abstract Interpretation of Declarative Languages. Ellis Horwood.Google Scholar
Nielson, F. 1987 b. Strictness analysis and denotational abstract interpretation (extended abstract). ACM Conf. on Principles of Programming Languages.ACM Press.CrossRefGoogle Scholar
Nielson, F. 1988. A formal type system for comparing partial evaluators. Partial Evaluation and Mixed Computation. North-Holland.Google Scholar
Nielson, H. R. and Nielson, F. 1988 a. Automatic binding time analysis for a typed λ-calculus. Science of Computer Programming 10. (Also see Proc. 15th ACM Symposium on Principles of Programming Languages. ACM Press).CrossRefGoogle Scholar
Nielson, F. and Nielson, H. R. 1988 b. 2-level λ-lifting. Proc. ESOP 1988. Volume 300 of Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Nielson, F. and Nielson, H. R. 1988 c. Two-level semantics and code generation. Theor. Comput. Sci. 56.CrossRefGoogle Scholar
Nielson, F. 1989. Two-level semantics and abstract interpretation. Theor. Comput. Sci. 69.CrossRefGoogle Scholar
Nielson, H. R. and Nielson, F. 1989. Transformations on higher-order functions. Proc. Functional Programming and Computer Architecture Conference.ACM Press.CrossRefGoogle Scholar
Nielson, H. R. and Nielson, F. 1990 a. Functional completeness of the mixed λ-calculus and combinatory logic. Theor. Comput. Sci. 70.CrossRefGoogle Scholar
Nielson, H. R. and Nielson, F. 1990 b. Eureka definitions for free! or Disagreement points for fold/unfold transformations. Proc. ESOP '90. Volume 432 of Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Nielson, H. R. and Nielson, F. 1990 c. Context information for lazy code generation. Proc. LISP and Functional Programming Conference.ACM Press.CrossRefGoogle Scholar
Peyton, Jones S. 1987. The Implementation of Functional Programming Languages. Prentice Hall.Google Scholar
Schmidt, D. A. 1988. Static properties of partial evaluation. Partial Evaluation and Mixed Computation. North-Holland.Google Scholar
Turner, D. 1979. A new implementation technique for applicative languages. Software, Practice and Experience 9.CrossRefGoogle Scholar
Turner, D. A. 1985. Miranda: a non-strict functional language with polymorphic types. Proc. Functional Programming Languages and Computer Architectures. Volume 201 of Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Wadler, P. 1987. Strictness analysis on non-flat domains (by abstract interpretation over finite domains). In Abramsky, S. and Hankin, C. (editors), Abstract Interpretation of Declarative Languages. Ellis Horwood.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.