Advertisement

Modeling an Algebraic Stepper

  • John Clements
  • Matthew Flatt
  • Matthias Felleisen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2028)

Abstract

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.

References

  1. 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. 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. 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. 4.
    Bertot, Y. Occurrences in debugger specifications. In ACM SIGPLAN Conference on Programming Language Design and Implementation, 1991.Google Scholar
  5. 5.
    Felleisen, M. Programming languages and their calculi. Unpublished Manuscript. http://www.cs.rice.edu/~matthias/411/mono.ps.
  6. 6.
    Felleisen, M. and R. Hieb. The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science, 102:235–271, 1992.CrossRefMathSciNetGoogle Scholar
  7. 7.
    Ferguson, H. E. and E. Berner. Debugging systems at the source language level. Communications of the ACM, 6(8):430–432, August 1963.CrossRefGoogle Scholar
  8. 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. 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. 10.
    Flatt, M. PLT MzScheme: Language manual. Technical Report TR97-280, Rice University, 1997.Google Scholar
  11. 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. 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
  13. 13.
    Hannan, J. and D. Miller. From operational semantics to abstract machines. Journal of Mathematical Structures in Computer Science, 2(4):415–459, 1992.MATHMathSciNetCrossRefGoogle Scholar
  14. 14.
    Kellomaki, P. Psd ― a portable scheme debugger, Feburary 1995.Google Scholar
  15. 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. 16.
    Krishnamurthi, S. PLT McMicMac: Elaborator manual. Technical Report 99-334, Rice University, Houston, TX, USA, 1999.Google Scholar
  17. 17.
    Landin, P. J. The mechanical evaluation of expressions. Comput. J., 6(4):308–320, 1964.MATHGoogle Scholar
  18. 18.
    Milner, R. Communication and Concurrency. Prentice Hall, 1989.Google Scholar
  19. 19.
    Moreau, L. A syntactic theory of dynamic binding. Higher-Order and Symbolic Computation, 11(3):233–279, 1998.MATHCrossRefGoogle Scholar
  20. 20.
    Naish, L. and T. Barbour. Towards a portable lazy functional declarative debugger. In 19th Australasian Computer Science Conference, 1996.Google Scholar
  21. 21.
    Plotkin, G. D. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, pages 125–159, 1975.Google Scholar
  22. 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. 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. 24.
    Tolmach, A. Debugging Standard ML. PhD thesis, Department of Computer Science, Princeton University, October 1992.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • John Clements
    • 1
  • Matthew Flatt
    • 1
  • Matthias Felleisen
    • 1
  1. 1.Department of Computer ScienceRice UniversityHouston

Personalised recommendations