Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to main content

Lazy debugging of lazy functional programs

  • Regular Papers
  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

The debugging of fully lazy functional programs can require searching a very large reduction-history space containing many delayed computations. A debugger should provide a means to obtain a source level representation of the computation, which can be large, and a means to select the appropriate part of the computation to investigate, which can be difficult. A method is presented to compile functional programs to combinator code such that a source-like representation of any part of a computation graph can be efficiently reconstructed at run-time. Other less efficient methods require excessive compile-time guidance as to the specific part of the computation to be investigated. Reconstruction, forward reduction, and a history-rollback mechanism combine to make the entire source-like reduction-history space dynamically available at run-time. The deferring of debugging decisions until run-time is called lazy dubugging. Once the computation-sequence is meaningfully and efficiently available, the problem of debugging becomes that of localizing the search for the error. Some searching issues are discussed with respect to graph browsing and user-interface design. The method shows promise as a programmer tool to debug programs and to informally reason about the time and space behavior of fully lazy functional programs, a nonintuitive process due to the subtleness of sharing and delayed computations.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

Explore related subjects

Discover the latest articles, news and stories from top researchers in related subjects.

References

  1. Bentley, J.,Writing Efficient Programs, Prentice-Hall, Englewood Cliffs, NJ, 1982.

    MATH  Google Scholar 

  2. Augustsson, L. and Johnsson, T., “The Chalmers lazy-ML compiler,”The Computer Journal, Vol. 32, No. 2, pp. 127–141, 1989.

    Article  Google Scholar 

  3. Bentley, J.,Programming Pearls, AT&T Bell Laboratories, Murray Hill, NJ, 1986.

    Google Scholar 

  4. Burge, W. H.,Recursive Programming Techniques, Addison-Wesley, Reading, MA, 1974.

    Google Scholar 

  5. Burn, G. L., Peyton Jones, S. L., and Robson, J. D., “The spineless G-machine,”Proceedings of the 1988 ACM Symposium on Lisp and Functional Programming, Association for Computing Machinery, Snowbird, UT, pp. 244–258, 1988.

  6. Eisenstadt, M. and Brayshaw, M., “The transparent PROLOG machine (TPM): An execution model and graphical debugger for logic programming,”Journal of Logic Programming, 5, pp. 277–342, 1988.

    Article  MATH  Google Scholar 

  7. Glaser, H. W. and Thompson, P., “Lazy garbage collection,”Software—Practice and Experience, Vol. 17, No. 1, pp. 1–4, 1987.

    Article  Google Scholar 

  8. Hennessy, J., “Symbolic debugging of optimized code,”ACM TOPLAS, Vol. 4, No. 3, pp. 323–344, July, 1982.

    Article  MATH  Google Scholar 

  9. Hudak, P. and Goldberg, B., “Experiments in diffused combinator reduction,”Proceedings of the 1984 ACM Conference on LISP and Functional Programming, Association for Computing Machinery, pp. 167–176, August, 1984.

  10. Hudak, P. and Kranz, D., “A combinator-based compiler for a functional language,”Proceedings of the 11th Annual ACM Symposium on the Principles of Programming Languages, Association for Computing Machinery, New York, pp. 122–132, January, 1984.

  11. Hughes, J., “The design and implementation of programming languages,”,Ph.D. Thesis, Oxford University, July, 1984.

  12. Johnsson, T., “Lambda lifting: Transforming programs to recursive equations,” inFunctional Languages and Computer Architecture, Lecture Notes in Computer Science 201 (Jean-Pierre Jouannaud ed.), Springer-Verlag, Berlin, pp. 190–203, September, 1985.

    Google Scholar 

  13. Lieberman, H., “Steps toward better debugging tools for LISP,”ACM Symposium on LISP and Functional Programming, Association for Computing Machinery, pp. 247–255, August, 1984.

  14. O’Donnell, John T. and Hall, C. V., “Debugging in applicative languages,”Lisp and Symbolic Computation, 1, pp. 113–145, 1988.

    Article  Google Scholar 

  15. Peyton Jones, S. L., “Parsing distfix operators”,Communications of the ACM, Vol. 29, No. 2, pp. 118–122, February, 1986.

    Article  Google Scholar 

  16. Peyton Jones, S. L.,The Implementation of Functional Programming Languages, Prentice-Hall, New York, 1987.

    MATH  Google Scholar 

  17. Milner, R., “A theory of type polymorphism in programming,”Journal of Computer and System Sciences, 17, pp. 348–375, 1978.

    Article  MATH  MathSciNet  Google Scholar 

  18. Satterthwaite, E., “Debugging tools for high level languages,”Software—Practice and Experience, 2, pp. 197–217, 1972.

    Article  MATH  Google Scholar 

  19. Shapiro, E. Y.,Algorithmic Program Debugging, MIT Press, Cambridge, MA, 1983.

    Google Scholar 

  20. Stoye, W. R., Clarke, T. J. W., and Norman, A. C., “Some practical methods for rapid combinator reduction”,Conference Record of the 1984 ACM Symposium on LISP and Functional Programming, Association for Computing Machinery, August, 1984.

  21. Shu, N. C.,Visual Programming, Van Nostrand Reinhold, New York, 1988.

    Google Scholar 

  22. Tinker, P. and Katz, M., “Parallel execution of sequential scheme with Para Tran,”ACM, pp. 28–39, 1988.

  23. Toyn, I. and Runciman, C., “Adapting combinator and SECD machines to display snapshots of functional computations,”New Generation Computing, 4, pp. 339–363, 1986.

    Article  MATH  Google Scholar 

  24. Turner, D. A., “A new implementation technique for applicative languages,”Software— Practice and Experience, 9, pp. 31–49, 1979.

    Article  MATH  Google Scholar 

  25. Turner, D. A., “Another algorithm for bracket abstraction,”The Journal of Symbolic Logic, Vol. 44, No. 2, pp. 267–270, June, 1979.

    Article  MATH  MathSciNet  Google Scholar 

  26. Wadsworth, C. P., “Semantics and pragmatics of the lambda calculus,”Ph.D. Thesis, Oxford University, 1971.

  27. Wilensky, R.,LISPcraft, W. W. Norton, New York, 1984.

    MATH  Google Scholar 

  28. Kaisler, S.,INTERLISP: The Language and Its Usage, John Wiley & Sons, New York, 1986.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

About this article

Cite this article

Snyder, R.M. Lazy debugging of lazy functional programs. New Gener Comput 8, 139–161 (1990). https://doi.org/10.1007/BF03037471

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF03037471

Keywords