Skip to main content
Log in

A fine-grained account of Prolog execution for teaching and debugging

  • Published:
Instructional Science Aims and scope Submit manuscript

Abstract

A clear and consistent execution model of any programming language can lay the foundations not only for a good leaming experience, but also for a smoother design/edit/run/debug cycle. In this paper, we describe our attempt to construct precisely such a model for the logic programming language Prolog, based upon a notational extension of logic programming's traditional AND/OR trees. Our extension, called the “AORTA” diagram, is an And/OR Tree, Augmented to include invocation history “status boxes” at each node. This augmentation makes it possible to present a graphical view of Prolog execution which is very compact, yet which contains complete details of unification and control history, including multiple (backtracking) invocations and extra-logical features such as the cut. The paper describes our fine-grained view of Prolog execution in detail, and argues that this fine-grained view can readily be integrated into a coarse-grained model such as thatrequired for understanding the execution of very large programs. Indeed, our notation is already in use across a range of media, including textbook diagrams, video animations, and a graphical tracing and debugging facility running on modem graphics workstations.

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

Access this article

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

Instant access to the full article PDF.

Similar content being viewed by others

References

  • Bratko, I. (1986). Prolog programming for artificial intelligence. Reading, MA: Addison-Wesley.

    Google Scholar 

  • Brayshaw, M. and Eisenstadt, M. (1988). Adding data and procedure abstraction to the transparent Prolog Machine. In R. A. Kowalski and K. A. Bowen (Eds.), Logic programming, Volume 1, Cambridge, MA: MIT Press, 532–547.

    Google Scholar 

  • Brayshaw, M. and Eisenstadt, M. (in press). A practical graphical Prolog tracer. International Journal of Man-Machine Studies.

  • Brown, M. H. and Sedgewick, R. (1984). Progress report: Brown University Instructional Computing Laboratory, ACM SIGCSE Bulletin 16(1), February.

  • Bundy, A., Pain, H., Bma, P. and Lynch, L. (1986). A proposed Prolog story. DAI Research Paper 283, Department of Artificial Intelligence, University of Edinburgh.

  • Byrd, L. (1980). Understanding the control flow of Prolog programs. In S-Å Tamlund (Ed.), Proceedings of the 1980 Logic Programming Workshop, 127–138.

  • Clocksin, W. F. and Mellish, C. S. (1981). Programming in Prolog (First edition), New York: Springer-Verlag.

    Google Scholar 

  • Clocksin, W. F. and Mellish, C. S. (1984). Programming in Prolog (Second edition), New York: Springer-Verlag.

    Google Scholar 

  • Coombs M. J. and Stell, J. G. (1985). A model for debugging Prolog by symbolic execution: the separation of specification and procedure. Research Report MMIGR137, Department of Computer Science, University of Strathclyde.

  • Dewar, A. D. and Cleary, J. G. (1986). Graphical display of complex information within a Prolog debugger. International Journal of Man Machine Studies, 25 (4), 503–521.

    Google Scholar 

  • DuBoulay, J. B. H., O'Shea, T. and Monk, J. (1981). The black box inside the glass box: presenting computing concepts to novices. International Journal of Man Machine Studies, 14(3), 237–249.

    Google Scholar 

  • Eisenstadt, M. (1988). (Ed.) Intensive Prolog. Associate Student Central Office (Course PD622), The Open University, Milton Keynes, U.K.: Open University Press.

    Google Scholar 

  • Eisenstadt, M. and Brayshaw, M. (1988). The Transparent Prolog Machine (TPM): an execution model and graphical debugger for logic programming. Journal of Logic Programming, 5(4), 277–342.

    Google Scholar 

  • Gunakara Sun Systems Limited (1988). PROLOGRAPH: programming in pictures, personal demonstration.

  • Hardy, S. (1984). A new software environment for list-processing and logic programming. In T. O'Shea and M. Eisenstadt (Eds.), Artificial Intelligence: tools, techniques, and applications. New York: Harper & Row.

    Google Scholar 

  • Kowalski, R. (1979). Logic for problem solving. New York: Elsevier, North Holland.

    Google Scholar 

  • Rajan, T. (1987). The design of animated tracing tools for novice programmers, In H. J. Bullinger and B. Shackel (Eds.), Human-computer interaction-Proc. Interact '87, Amsterdam: Elsevier Science Publishers B.V., North Holland, IFIP, 1987.

    Google Scholar 

  • Shapiro, E. Y. (1982). Algorithmic program debugging. Cambridge, MA: MIT Press.

    Google Scholar 

  • Stirling, L. and Shapiro, E. Y. (1986). The art of Prolog: advanced programming techniques, Cambridge, MA: MIT Press.

    Google Scholar 

  • Pain, H, and Bundy, A. (1987). What stories should we tell novice Prolog programmers? In R. Hawley (Ed.), Artificial intelligence programming Environments. New York: Wiley.

    Google Scholar 

  • Taylor, J. (1987). Programming in Prolog: an in-depth study of problems for beginners learning to program in Prolog. PhD Thesis, Cognitive Studies Programme, University of Sussex.

  • Teitelbaum, T. and Reps, T. (1981). The Cornell Program Synthesizer: a syntax-directed programming environment. Comm. ACM., 24(9) 563–573.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Eisenstadt, M., Brayshaw, M. A fine-grained account of Prolog execution for teaching and debugging. Instr Sci 19, 407–436 (1990). https://doi.org/10.1007/BF00116447

Download citation

  • Issue Date:

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

Keywords

Navigation