Set-based analysis of ML programs

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.

[1]  Neil D. Jones,et al.  Flow analysis and optimization of LISP-like structures , 1979, POPL.

[2]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[3]  Nevin Heintze,et al.  ML Partial Evaluation Using Set-Based Analysis , 1994 .

[4]  NEVIN HEINTZE Appendix II : Construction of Set Constraints , 1993 .

[5]  Alexander Aiken,et al.  Lakshman. Soft Typing with Conditional Types. Consider a Constraint of the Form , 1995 .

[6]  Olivier Danvy,et al.  Tutorial notes on partial evaluation , 1993, POPL '93.

[7]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[8]  Robin Milner,et al.  Definition of standard ML , 1990 .

[9]  Nevin Charles Heintze,et al.  Set based program analysis , 1992 .

[10]  N. Heintze Set Based Analysis of Arithmetic , 1993 .

[11]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

[12]  Joxan Jaffar,et al.  An engine for logic program analysis , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[13]  Olin Shivers,et al.  Control flow analysis in scheme , 1988, PLDI '88.

[14]  Robert Cartwright,et al.  A practical soft type system for scheme , 1997, TOPL.

[15]  Torben Æ. Mogensen Separating binding times in language specifications , 1989, Conference on Functional Programming Languages and Computer Architecture.

[16]  Jens Palsberg,et al.  Object-oriented type systems , 1994, Wiley professional computing.

[17]  Robert Cartwright,et al.  Soft typing , 2004, SIGP.

[18]  Neil D. Jones,et al.  Program Flow Analysis: Theory and Application , 1981 .

[19]  N. S. Barnett,et al.  Private communication , 1969 .

[20]  Torben Æ. Mogensen,et al.  A Backwards Analysis for Compile-time Garbage Collection , 1990, ESOP.

[21]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[22]  Harald Ganzinger,et al.  Set constraints are the monadic class , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[23]  Neil D. Jones,et al.  Complexity of flow analysis, inductive assertion synthesis and a language due to Dijkstra , 1980, 21st Annual Symposium on Foundations of Computer Science (sfcs 1980).

[24]  Joxan Jaffar,et al.  A finite presentation theorem for approximating logic programs , 1989, POPL '90.

[25]  John C. Mitchell,et al.  Type inference with simple subtypes , 1991, Journal of Functional Programming.

[26]  Alexander Aiken,et al.  Solving systems of set constraints , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[27]  Jens Palsberg,et al.  Safety Analysis Versus Type Inference for Partial Types , 1992, Inf. Process. Lett..

[28]  John C. Reynolds,et al.  Automatic computation of data set definitions , 1968, IFIP Congress.

[29]  Prateek Mishra,et al.  Declaration-free type checking , 1985, POPL.

[30]  Fritz Henglein,et al.  Efficient Type Inference for Higher-Order Binding-Time Analysis , 1991, FPCA.

[31]  Peter Lee,et al.  Signatures for a network protocol stack: a systems application of Standard ML , 1994, LFP '94.

[32]  Alexander Aiken,et al.  Soft typing with conditional types , 1994, POPL '94.

[33]  Flemming Nielson,et al.  Two-level functional languages , 1992, Cambridge tracts in theoretical computer science.