Hostname: page-component-7c8c6479df-fqc5m Total loading time: 0 Render date: 2024-03-28T12:20:51.070Z Has data issue: false hasContentIssue false

Algorithmic debugging for lazy functional languages1

Published online by Cambridge University Press:  07 November 2008

Henrik Nilsson
Affiliation:
Programming Environments Laboratory, Department of Computer and Information Science, Linköping University, S-581 83 Linköping, Sweden (e-mail: henni@ida.liu.se, paf@ida.liu.se)
Peter Fritzson
Affiliation:
Programming Environments Laboratory, Department of Computer and Information Science, Linköping University, S-581 83 Linköping, Sweden (e-mail: henni@ida.liu.se, paf@ida.liu.se)
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.

Lazy functional languages have non-strict semantics and are purely declarative, i.e. they support the notion of referential transparency and are devoid of side-effects. Traditional debugging techniques are, however, not suited for lazy functional languages, since computations generally do not take place in the order one might expect. Since algorithmic debugging allows the user to concentrate on the declarative aspects of program semantics, and will semi-automatically find functions containing bugs, we propose to use this technique for debugging lazy functional programs. Because of the non-strict semantics of lazy functional languages, arguments to functions are in general partially evaluated expressions. The user is, however, usually more concerned with the values that these expressions represent. We address this problem by providing the user with a strictified view of the execution trace whenever possible. In this paper, we present an algorithmic debugger for a lazy functional language based on strictification and some experience in using it. A number of problems with the current implementation of the debugger (e.g. too large trace size and too many questions asked) are also discussed and some techniques for overcoming these problems, at least partially, are suggested. The key techniques are immediate strictification and piecemeal tracing.

Type
Research Article
Copyright
Copyright © Cambridge University Press 1994

References

Augustsson, L. (1984) A compiler for lazy ML. In: Proceedings ACM Conference on LISP and Functional Programming, pp. 218227, 08.CrossRefGoogle Scholar
Augustsson, L. (1987) Compiling Lazy Functional Languages part II. PhD thesis, Department of Computer Science, Chalmers University of Technology, 12.Google Scholar
Augustsson, L. (1991) The lack of suitable debugging tools for lazy functional languages. Personal communication, 11.Google Scholar
Drabent, W., Nadjm-Tehrani, S. and Maluszynski, J. (1988) The use of assertions in algorithmic debugging. In: Proceedings FGCS Conference,Tokyo, Japan, pp. 573581.Google Scholar
Fritzson, P., Gyimothy, T., Kamkar, M. and Shahmehri, N. (1991) Generalized algorithmic debugging and testing. In: Proceedings ACM SIGPLAN ConferenceToronto, Canada, pp. 317326, 06. (A revised version to appear in ACM Letters of Programming Languages and Systems.)CrossRefGoogle Scholar
Henhapl, W., Kaes, S and Snelting, S. (1991) Utilizing fifth generation technology in software development tools. Report PI-R3/91, Technische Hochschule Darmstadt, 03.Google Scholar
Hazan, J.E. and Morgan, R.G. (1993) The location of errors in functional programs. In: Fritzson, P. A. (ed.) Automated and Algorithmic Debugging, Vol. 749 of Lecture Notes in Computer Science, pp. 135152, Linköping, Sweden, 05.Google Scholar
Hall, C.V. and O'Donnell, J.T. (1985) Debugging in a side effect free programming environment. In: Proceedings ACM SIGPLAN Symposium on Language Issues in Programming Environments,Seattle, LA, pp. 6068, 06. (Proceedings published in SIGPLAN Notices 20(7).)CrossRefGoogle Scholar
Johnsson, T. (1984) Efficient compilation of lazy evaluation. In: Proceedings ACM SIGPLAN Symposium on Compiler Construction, pp. 5869, 06. (Proceedings published in SIGPLAN Notices 19(6).)CrossRefGoogle Scholar
Johnsson, T. (1987) Compiling Lazy Functional Languages. PhD thesis, Department of Computer Science, Chalmers University of Technology, 02.Google Scholar
Kamin, S. (1990) A debugging environment for functional programming in Centaur. Research report, Institut National de Recherche en Informatique et en Automatique (INRIA), Le Chesnay, France, 07.Google Scholar
Kamkar, M. (1993) Interprocedural Dynamic Slicing with Applications to Debugging and Testing. PhD thesis, Department of Computer and Information Science, Linköping University, Sweden, 04.Google Scholar
Kishon, A., Hudak, P. and Consel, C. (1991) Monitoring semantics: A formal framework for specifying, implementing, and reasoning about execution monitors. In: Proceedings ACM SIGPLAN Conference on Programming Language Design and Implementation,Toronto, Canada,June.Google Scholar
Shai Kishon, A. (1992) Theory and Art of Semantics Directed Program Execution Monitoring. PhD thesis, Yale University, 05.Google Scholar
Kamkar, M., Shahmehri, N. and Fritzson, P. (1992) Interprocedural dynamic slicing. In: Bruynooghe, M. and Wirsing, M. (eds.), Programming Languages Implementation and Logic Programming, Vol. 631 of Lecture Notes in Computer Science, pp. 370384, Leuven, Belgium, 08 1992.Google Scholar
Naish, L. (1992) Declarative debugging of lazy functional programs. Research Report 92/6, Department of Computer Science, University of Melbourne, Australia.Google Scholar
Nilsson, H. and Fritzson, P. (1992) Algorithmic debugging for lazy functional languages. In: Bruynooghe, M. and M., Wirsing (eds.) Programming Language Implementation and Logic Programming, Vol.631 of Lecture Notes in Computer Science, pp. 385399, Leuven, Belgium, 08.CrossRefGoogle Scholar
Nilsson, H. and Fritzson, P. (1993) Lazy algorithmic debugging: Ideas for practical implementation. In: Fritzson, P.A. (ed.) Automated and Algorithmic Debugging, Vol. 749 of Lecture Notes in Computer Science, pp. 117134, Linköping, Sweden, 05.Google Scholar
Nilsson, H. (1991) Freja: A small non-strict, purely functional language. MSc dissertation, Department of Computer Science and Applied Mathematics, Aston University, Birmingham, UK, 09.Google Scholar
O'Donnell, J.T. and Hall, C.V. (1988) Debugging in applicative languages. Lisp and Symbolic Computation 1(2) 113145.CrossRefGoogle Scholar
Peyton-Jones, S.L. (1987) The Implementation of Functional Programming Languages. Prentice Hall.Google Scholar
Seviora, R.E. (1987) Knowledge-based program debugging systems. IEEE Software (3) 2032, 05.CrossRefGoogle Scholar
Shapiro, E.Y.Algorithmic Program Debugging. MIT Press.Google Scholar
Shahmehri, N. (1991) Generalized Algorithmic Debugging. PhD thesis, Department of Computer and Information Science, Linköping University, Sweden.Google Scholar
Toyn, I. (1987) Exploratory Environments for Functional Programming. PhD thesis, Department of Computer Science, University of York, UK, 04.Google Scholar
Toyn, I. and Runciman, C. (1986) Adapting combinator and SECD machines to display snapshots of functional computations. New Generation Computing 4 (4) 339363.Google Scholar
Turner, D.A. (1985) Miranda: A non-strict functional language with polymorphic types. In: Proceedings IFIP International Conference on Functional Programming Languages and Computer Architecture, FPCA'85, Vol. 201 in Lecture Notes in Computer Science,Nancy, France.CrossRefGoogle Scholar
Weiser, M. (1982) Programmers use slices when debugging. Communications of the ACM 25 (7): 446452.CrossRefGoogle Scholar
Weiser, M. (1984) Program slicing. IEEE Transactions on Software Engineering 10 (4): 352357.Google Scholar
Westman, R. and Fritzson, P. (1993) Graphical user interfaces for algorithmic debugging. In: Fritzson, P.A. (ed.) Automated and Algorithmic Debugging, Vol. 749 of Lecture Notes in Computer Science, pp. 273286, Linköping Sweden,May.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.