Advertisement

Compile-Time Type Prediction and Type Checking for Common Lisp Programs

  • Randall Beer

Abstract

This paper describes a system for both predicting and checking the types of Common Lisp programs at compile-time. The system is capable of deriving type declarations from constraints implicit in the code and identifying potential run-time type errors. These capabilities can be used to improve the efficiency of Common Lisp on general-purpose architectures without sacrificing safety or ease of use. The system operates by using the type constraints of primitive functions to propagate known information throughout a dataflow graph of the program.

Keywords

Inference Rule Type Inference Type Check Require Type Dataflow Graph 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    Bauer, A.M. and Saal, H.J. (1974). Does APL really need run-time checking? Software — Practice and Experience 4: 129–138.CrossRefGoogle Scholar
  2. [2]
    Beer, R. D. (1987). Preliminary report on a practical type inference system for Common Lisp. LISP Pointers 1(2): 5–11.CrossRefGoogle Scholar
  3. [3]
    Borning, A.H. and Ingalls, D.H.H. (1982). A type declaration and inference system for Smalltalk. In Conference Record of the Ninth Annual ACM Symposium on Principles of Programming Languages (pp. 133–141).Google Scholar
  4. [4]
    Brooks, R.A. and Gabriel, R.P. (1984). A critique of Common Lisp. In Proceedings of the 1984 Symposium on Lisp and Functional Programming (pp. 1–8).Google Scholar
  5. [5]
    Brooks, R.A., Gabriel, R.P. and Steele, G.L. Jr. (1982). An optimizing compiler for lexically scoped LISP. In Proceedings of the 1982 ACM Symposium on Compiler Construction (pp. 261–275).Google Scholar
  6. [6]
    Brooks, R.A., Posner, D.B., McDonald, J.L., White, J.L., Benson, E. and Gabriel, R.P. (1986). Design of an optimizing, dynamically retargetable compiler for Common Lisp. In Proceedings of the 1986 Symposium on Lisp and Functional Programming (pp. 67–85).Google Scholar
  7. [7]
    Budd, T.A. (1988). An APL Compiler. Springer-Verlag.Google Scholar
  8. [8]
    Cousot, P. and Cousot, R. (1977). Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the Fourth Annual ACM Symposium on Principles of Programming Languages (pp. 238–252).Google Scholar
  9. [9]
    Johnson, P.M. (1990). Type flow analysis for exploratory software development. Ph.D. Thesis and COINS Technical Report 90–64, University of Massachusetts at Amherst.Google Scholar
  10. [10]
    Kaplan, M.A. and Ullman, J.D. (1980). A scheme for the automatic inference of variable types. J. A CM 27(1): 128–145.MathSciNetMATHGoogle Scholar
  11. [11]
    Kessler R. R., Peterson, J.C., Carr H., Duggan, G.P., Knell, J. and Krohnfeldt, J.J. (1986). EPIC — A retargetable, highly optimizing Lisp compiler. In Proceedings of the 1986 ACM Symposium on Compiler Construction (pp. 118–130).Google Scholar
  12. [12]
    Miller, T.C. (1979). Type checking in an imperfect world. In Conference Record of the Sixth Annual ACM Symposium on Principles of Programming Languages (pp. 237–243).Google Scholar
  13. [13]
    Milner, R. (1978). A theory of type polymorphism in programming. J. of Computer and System Sciences 17: 348–375.MathSciNetMATHCrossRefGoogle Scholar
  14. [14]
    Moon, D.A. (1985). Architecture of the Symbolics 3600. Proceedings of the 12th International Symposium on Computer Architecture (pp. 76–83).Google Scholar
  15. [15]
    Rees, J.A. and Adams, N.I. IV (1982). T: A dialect of Lisp or, LAMBDA: The ultimate software tool. In Proceedings of the 1982 Symposium on Lisp and Functional Programming (pp. 114–122).Google Scholar
  16. [16]
    Shivers, O. (1990). Data-flow analysis and type recovery in Scheme. Technical report CMU-CS-90-115, Carnegie Mellon University.Google Scholar
  17. [17]
    Steele, G.L. (1984). Common Lisp: The Language. Digital Press.Google Scholar
  18. [18]
    Steele, G.L. (1990). Common Lisp: The Language. Second Edition. Digital Press.Google Scholar
  19. [19]
    Steenkiste, P. and Hennessy, J. (1987). Tags and type checking in LISP: Hardware and software approaches. In Proceedings of the Second International Conference on Architectural Support for Programming Languages and Operating Systems (pp. 50–59).Google Scholar
  20. [20]
    Suzuki, N. (1981). Inferring types in Smalltalk. In Conference Record of the Eighth Annual ACM Symposium on Principles of Programming Languages (pp. 187–199).Google Scholar
  21. [21]
    Tennenbaum, A.M. (1974). Type determination in very high level languages. NSO-3, Courant Institute of Math. Sciences, New York Univ.Google Scholar
  22. [22]
    van Roggen W. 1987. Lisp implementations. LISP Pointers 1350–52Google Scholar

Copyright information

© Springer Science+Business Media New York 1993

Authors and Affiliations

  • Randall Beer
    • 1
  1. 1.Department of Computer Engineering and ScienceCase Western Reserve UniversityClevelandUSA

Personalised recommendations