Advertisement

A backward slicing algorithm for Prolog

  • Stéphane Schoenig
  • Mireille Ducassé
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1145)

Abstract

Slicing is a program analysis technique originally developed by Weiser for imperative languages. Weiser showed that slicing is a natural tool for debugging, but it has other numerous applications (program integration, program optimization, etc.)

In this article we describe a backward slicing algorithm for Prolog which produces executable slices. The proposed algorithm is applicable at least to pure Prolog extended by some simple built-in predicates that handle the explicit unification=/2 and arithmetic.

To our knowledge, this algorithm is the first one to be proposed for Prolog. Because of the indeterminism and lack of explicit control flow of Prolog, existing algorithms cannot be trivially adapted. The two main contributions of this paper are a general definition of slicing adapted to Prolog and a slicing algorithm that produces executable programs.

Keywords

Logic Program Search Tree Operational Semantic Original Program Predicate Symbol 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [BPM93]
    J. Boye, J. Paakki, and J. Małuszyński. Synthesis of directionality information for functional logic programs. In Third International Workshop WSA'93, Proceeding Static Analysis, Padova, Italy, volume 724 of LNCS, pages 165–177. Springer-Verlag, September 1993.Google Scholar
  2. [De89]
    S. K. Debray. Static inference of modes and data dependencies in logic programs. ACM Transactions on Programming Languages and Systems, 11(3):418–450, July 1989.Google Scholar
  3. [DM93]
    P. Deransart and J. Małuszyński. A grammatical view of logic programming. MIT Press, 1993. ISBN 0-262-04140-5.Google Scholar
  4. [DN94]
    M. Ducassé and J. Noyé. Logic programming environments: Dynamic program analysis and debugging. The Journal of Logic Programming, 19/20:351–384, May/July 1994.Google Scholar
  5. [Du92]
    M. Ducassé. An extendable trace analyser to support automated debugging. PhD thesis, University of Rennes I, France, June 1992. European Doctorate.Google Scholar
  6. [Du95]
    M. Ducassé, editor. Second international workshop on automated and algorithmic debugging, http://www.irisa.fr/manifestations/AADEBUG95/, May 1995.Google Scholar
  7. [GP95]
    T. Gyimóthy and J. Paakki. Static slicing of logic programs. In Ducassé [Du95].Google Scholar
  8. [GS95]
    R. Gupta and M.-L. Soffa. Hybrid slicing: an approach for refining static slices using dynamic information. In 3rd ACM Symposium on Foundation of Software Engineering. University of Pittsburgh, ACM, October 10–13 1995.Google Scholar
  9. [HKF95]
    T. Hoffner, M. Kamkar, and P. Fritzson. Evaluation of program slicing tools. In Ducassé [Du95].Google Scholar
  10. [HPR88]
    S. Horwitz, J. Prins, and T. Reps. On the adequacy of program dependence graphs for representing programs. In Conference record of the 15th ACM Symposium on Principles of Programming Languages (POPL'88), pages 146–157, San Diego, CA USA, 1988.Google Scholar
  11. [HR92]
    S. Horwitz and T. Reps. The use of program dependence graphs in software engineering. In 14th International Conference on Software Engineering (Melbourne Australia), pages 392–411, may 1992.Google Scholar
  12. [HRB90]
    S. Horwitz, T. Reps, and D. Binkley. Interprocedural slicing using dependence graphs. ACM Transactions on Programming Languages and Systems, TOPLAS, 12(1):26–60, [1] 1990.Google Scholar
  13. [Ko93]
    B. Korel. Identifying faulty modifications in software maintenance. In P. A. Fritzson, editor, First International Workshop On Automated Algorithmic Debugging, volume 749 of LNCS, Linkoeping, Sweden, May 1993. Springer-Verlag.Google Scholar
  14. [LR87]
    H. K. N. Leung and H. K. Reghbati. Comments on program slicing. IEEE Transaction on Software Engineering SE-13(12):1370–1371, December 1987.Google Scholar
  15. [Ly84]
    J. R. Lyle. Evaluating Variations on Program Slicing for Debugging. PhD thesis, University of Maryland, 1984.Google Scholar
  16. [Sh83]
    E. Y. Shapiro. Algorithmic Program Debugging. MIT Press, Cambridge, MA, 1983. ISBN 0-262-19218-7.Google Scholar
  17. [SS94]
    L. Sterling and E. Shapiro. The art of Prolog, 2nd edition. Advanced Programming Techniques. The MIT Press, 1994.Google Scholar
  18. [Ti95]
    F. Tip. A survey of program slicing techniques. Journal of Programming Languages, 3(3):121–189, September 1995.Google Scholar
  19. [Va94]
    W. W. Vasconcelos. A method for extracting Prolog programming techniques. Technical Report 27, Dept. Artificial Intelligence, University of Edinburgh, 80 South Bridge, Edinburgh EH1 1HN, Scotland, Great Britain, 1994.Google Scholar
  20. [We82]
    M. Weiser. Programmers use slices when debugging. Communications of the ACM, 25(7):446–452, July 1982.Google Scholar
  21. [We84]
    M. Weiser. Program slicing. IEEE Transactions on Software Engineering, SE-10(4):352–357, July 1984.Google Scholar
  22. [ZCU94]
    J. Zhao, J. Cheng, and K Ushijima. Literal dependence net and its use in concurrent logic programming environment. In Workshop on Parallel Logic Programming, pages 127–141, December 1994.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Stéphane Schoenig
    • 1
  • Mireille Ducassé
    • 2
  1. 1.IRISA/CNRSCampus Universitaire de BeaulieuRennes CedexFrance
  2. 2.IRISA/INSACampus Universitaire de BeaulieuRennes CedexFrance

Personalised recommendations