Modeling an Algebraic Stepper
- 537 Downloads
Programmers rely on the correctness of the tools in their programming environments. In the past, semanticists have studied the correctness of compilers and compiler analyses, which are the most important tools. In this paper, we make the case that other tools, such as debuggers and steppers, deserve semantic models, too, and that using these models can help in developing these tools.
Our concrete starting point is the algebraic stepper in DrScheme, our Scheme programming environment. The algebraic stepper explains a Scheme computation in terms of an algebraic rewriting of the program text. A program is rewritten until it is in a canonical form (if it has one). The canonical form is the final result.
The stepper operates within the existing evaluator, by placing breakpoints and by reconstructing source expressions from source information placed on the stack. This approach raises two questions. First, do the run-time breakpoints correspond to the steps of the reduction semantics? Second, does the debugging mechanism insert enough information to reconstruct source expressions?
To answer these questions, we develop a high-level semantic model of the extended compiler and run-time machinery. Rather than modeling the evaluation as a low-level machine, we model the relevant low-level features of the stepper’s implementation in a high-level reduction semantics. We expect the approach to apply to other semantics-based tools.
- 1.Balzer, R. M. EXDAMS ― EXtendable Debugging And Monitoring System. In AFIPS 1969 Spring Joint Computer Conference, volume 34, pages 567–580. AFIPS Press, May 1969.Google Scholar
- 2.Barendregt, H. P. The Lambda Calculus: Its Syntax and Semantics, volume 103 of Studies in Logic and the Foundations of Mathematics. North-Holland, revised edition, 1984.Google Scholar
- 3.Bernstein, K. L. and E. W. Stark. Operational semantics of a focusing debugger. In Eleventh Conference on the Mathematical Foundations of Programming Semantics, Volume 1 of Electronic Notes in Computer Science. Elsevier, March 1995.Google Scholar
- 4.Bertot, Y. Occurrences in debugger specifications. In ACM SIGPLAN Conference on Programming Language Design and Implementation, 1991.Google Scholar
- 5.Felleisen, M. Programming languages and their calculi. Unpublished Manuscript. http://www.cs.rice.edu/~matthias/411/mono.ps.
- 8.Findler, R. B., J. Clements, C. Flanagan, M. Flatt, S. Krishnamurthi, P. Steckler and M. Felleisen. Drscheme: A programming environment for Scheme. Journal of Functional Programming, 2001.Google Scholar
- 9.Findler, R. B., C. Flanagan, M. Flatt, S. Krishnamurthi and M. Felleisen. DrScheme: A pedagogic programming environment for Scheme. In International Symposium on Programming Languages: Implementations, Logics, and Programs, number 1292 in Lecture Notes in Computer Science, pages 369–388, 1997.CrossRefGoogle Scholar
- 10.Flatt, M. PLT MzScheme: Language manual. Technical Report TR97-280, Rice University, 1997.Google Scholar
- 11.Flatt, M., S. Krishnamurthi and M. Felleisen. Classes and mixins. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 171–183, January 1998.Google Scholar
- 12.Hall, C. and J. O’Donnell. Debugging in a side effect free programming environment. In ACM SIGPLAN symposium on Language issues in programming environments, 1985.Google Scholar
- 14.Kellomaki, P. Psd ― a portable scheme debugger, Feburary 1995.Google Scholar
- 15.Kishon, A., P. Hudak and C. Consel. Monitoring semantics: a formal framework for specifying, implementing and reasoning about execution monitors. In ACM SIG-PLAN Conference on Programming Language Design and Implementation, pages 338–352, June 1991.Google Scholar
- 16.Krishnamurthi, S. PLT McMicMac: Elaborator manual. Technical Report 99-334, Rice University, Houston, TX, USA, 1999.Google Scholar
- 18.Milner, R. Communication and Concurrency. Prentice Hall, 1989.Google Scholar
- 20.Naish, L. and T. Barbour. Towards a portable lazy functional declarative debugger. In 19th Australasian Computer Science Conference, 1996.Google Scholar
- 21.Plotkin, G. D. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, pages 125–159, 1975.Google Scholar
- 22.Sansom, P. and S. Peyton-Jones. Formally-based profiling for higher-order functional languages. ACM Transactions on Programming Languages and Systems, 19(1), January 1997.Google Scholar
- 23.Sparud, J. and C. Runciman. Tracing lazy functional computations using redex trails. In Symposium on Programming Language Implementation and Logic Programming, 1997.Google Scholar
- 24.Tolmach, A. Debugging Standard ML. PhD thesis, Department of Computer Science, Princeton University, October 1992.Google Scholar