skip to main content
article
Free Access

Set-based analysis of ML programs

Authors Info & Claims
Published:01 July 1994Publication History
Skip Abstract Section

Abstract

Reasoning about program variables as sets of “values” leads to a simple, accurate and intuitively appealing notion of program approximation. This paper presents approach for the compile-time analysis of ML programs. To develop the core ideas of the analysis, we consider a simple untyped call-by-value functional language. Starting with an operational semantics for the language, we develop an approximate “set-based” operational semantics, which formalizes the intuition of treating program variables as sets. The key result of the paper is an O(n3) algorithm for computing the set based approximation of a program. We then extend this analysis in a natural way to deal with arrays, arithmetic, exceptions and continuations. We briefly describe our experience with an implementation of this analysis for ML programs.

References

  1. 1 A. Aiken and E. Wimmers, "Solving Systems of Set Constraints", Proc. 7tn IEEE Syrup. on Logic in Com. purer Science, Santa Cruz, pp. 329-340, June 1992.Google ScholarGoogle ScholarCross RefCross Ref
  2. 2 A. Aiken and E. Wimmers, "Type Inclusion and Type Inference", Proc. 6*n A CM Con/. on Functional Programming and Computer Architecture, Copenhagen, pp. 31-41, June 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 A. Aiken, E. Wimmers and T.K. Lakshman, "Soft Typing with Conditional Types" Proc. 21*h ACM Syrup. on Principles o/Programming Languages, Portland, OR, pp. 163-173, January 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 A. Appel, "Compiling with Continuations", Cambridge University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 L. Bachmair, H. Ganzinger and U. Waldmann, "Set Constraints are the Monadic Class", Technical Report MPI-I-92-240, Max-Planck-institute for Computer Science, December 1992.Google ScholarGoogle Scholar
  6. 6 E. Biagioni, R. Harper, P. Lee, and B. Milnes, "Signatures for a network protocol stack: A systems application of Standard ML", Proc. 199~i ACM Conf. on Lisp and Functional Programming, Orlando, Florida, June 1994, to appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7 R. Cartwright and M. Fagan, "Soft Typing", Proc. 1991 A CM Conj. on Programming Language Design and Implementation, Toronto, pp. 278-292, June 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 C. Consel and O. Danvy, "Tutorial Notes on Partial Evaluation", Proc. 20tn ACM Syrup. on Principle8 of Programming Languages, Charleston, pp. 493-501, January 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9 P. Cousot and R. Cousot, "Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints", Proc. 4*h A CM Syrup. on Principles of Programming Languages, Los Angeles, pp. 238-252, January 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 N. Heintze, "Set-Based Program Analysis", Ph.D. thesis, School of Computer Science, Carnegie Mellon University, October 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 11 N. Heintze, "Set-Based Program Analysis and Arithmetic'', Technical Report, School of Computer Science, Carnegie Mellon University, December 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 12 N. Heintze and J. Jaffar, "A Finite Presentation Theorem for Approximating Logic Programs", Proc. 17tn A CM Syrup. on Principles o} Programming Languages, San Francisco, pp. 197-209, January 1990. (A full version of this paper appears as IBM Technical Report RC 16089 (~ 71415), 66 pp., August 1990.) Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 N. Heintze and J. Jaffar, "A Decision Procedure for a Class of Herbrand Set Constraints", Proc. 5th IEEE Syrup. on Logsc, n Computer Science, Philadelphia, pp. 42-51, June 1990. (A full version of this paper appears as Carnegie Mellon University Technical Report CMU-CS-91-110, 42 pp., February 1991.)Google ScholarGoogle Scholar
  14. 14 N. Heintze and J. Jaffar, "An Engine for Logic Program Analysis", Proc. 7th IEEE Syrup. on Logic in Computer Science, Santa Cruz, pp. 318-328, June 1992.Google ScholarGoogle ScholarCross RefCross Ref
  15. 15 F. Henglein, "Efficient Type Inference for Higher- Order Binding-Time Analysis", Proceedings 5*n A CM- FPCA, Cambridge MA, LNCS 523, pp. 448-472, August 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16 T. Jensen and T. Mogensen, "A Backwards Analysis for Compile-Time Garbage Collection", Proc. 3ra European Syrup. on Programming, Copenhagen, LNCS 432, pp. 227-239, May 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 17 N. Jones, "Flow Analysis of Lazy Higher-Order Functional Programs", in Abstract Interpretation of Declarative Languages, S. Abramsky and C. Hankln (Eds.), Ellis Horwood, 1987.Google ScholarGoogle Scholar
  18. 18 N. Jones, C. Gomard and P. Sestoft, "Partial Evaluation and Automatic Program Generation", "Prentice- Hall International", 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 19 N. Jones and S. Muchnick, "Flow Analysis and Optimization of LISP-like Structures", Proc. 6th A CM Syrup. on Principles of Programming Languages, San Antonio, pp. 244-256, January 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 20 N. Jones and S. Muchnick, "Complexity of Flow Analysis, Inductive Assertion Synthesis, and a Language due to Dijkstra", Proc. 21~t IEEE-FOCS, Syracuse, pp. 185-190, October 1980. (Also in, Program Flow Analttsis: Theory and Applications, N. Jones and S. Muchnick (Eds.), Prentice-Hall, 1981.) Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 21 K. Malmkjeer, N. Heintze and O. Danvy, "ML Partial Evaluation using Set-Based Analysis", submitted for publication.Google ScholarGoogle Scholar
  22. 22 R. Milner, M. Torte and R. Harper, "The Definition of Standard ML', MIT Press, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23 T. Mogensen, ~Separating Binding Times in Language Specifications", Proc. Functional Programming and Computer Architecture, London, ACM, pp. 12-25, September 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 24 F. Nielson and H. Nielson, "Two-Level Functional Languages", Cambridge University Press, Vol 34, Cambridge Tracts in Theoretical Computer Science, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 25 O. Shivers, "Control Flow AnMysis in Scheme", Proc. 1988 A CM Conf. on Programming Language Design and Implementation, Atlanta, pp. 164-174, June 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 26 J. Palsberg, Private Communication, November 1993.Google ScholarGoogle Scholar
  27. 27 J. Palsberg and M. Schwartzbach, "Safety Analysis versus Type Inference for Partial Types" Informstion Processing Letters, Vol 43, pp. 175-180, North- Holland, September 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 28 J. Palsberg and M. Schwartzbach, "Object-Oriented Type Systems", John Wiley & Sons, to appear, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 29 J. Reynolds, "Automatic Computation of Data Set Definitions", In/ormation Processing 68, pp. 456-461, North-Holland, 1969.Google ScholarGoogle Scholar
  30. 30 A. Wright and R. Cartwright, "A Practical Soft Type System for Scheme", Proc. 199j A CM Conf. on Lisp and Functional Programming, Orlando, Florida, June 1994, to appear. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Set-based analysis of ML programs

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM SIGPLAN Lisp Pointers
            ACM SIGPLAN Lisp Pointers  Volume VII, Issue 3
            July-Sept. 1994
            327 pages
            ISSN:1045-3563
            DOI:10.1145/182590
            Issue’s Table of Contents
            • cover image ACM Conferences
              LFP '94: Proceedings of the 1994 ACM conference on LISP and functional programming
              July 1994
              327 pages
              ISBN:0897916433
              DOI:10.1145/182409

            Copyright © 1994 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 1 July 1994

            Check for updates

            Qualifiers

            • article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader