Hostname: page-component-78c5997874-mlc7c Total loading time: 0 Render date: 2024-11-10T10:59:46.165Z Has data issue: false hasContentIssue false

Forward slicing of functional logic programs by partial evaluation*

Published online by Cambridge University Press:  01 January 2007

JOSEP SILVA
Affiliation:
DSIC, Technical University of Valencia, Camino de Vera s/n, E-46022 Valencia, Spain (e-mail; jsilva@dsic.upv.es, gvidal@dsic.upv.es
GERMÁN VIDAL
Affiliation:
DSIC, Technical University of Valencia, Camino de Vera s/n, E-46022 Valencia, Spain (e-mail; jsilva@dsic.upv.es, gvidal@dsic.upv.es

Abstract

Program slicing has been mainly studied in the context of imperative languages, where it has been applied to a wide variety of software engineering tasks, like program understanding, maintenance, debugging, testing, code reuse, etc. This work introduces the first forward slicing technique for declarative multi-paradigm programs which integrate features from functional and logic programming. Basically, given a program and a slicing criterion (a function call in our setting), the computed forward slice contains those parts of the original program which are reachable from the slicing criterion. Our approach to program slicing is based on an extension of (online) partial evaluation. Therefore, it provides a simple way to develop program slicing tools from existing partial evaluators and helps to clarify the relation between both methodologies. A slicing tool for the multi-paradigm language Curry, which demonstrates the usefulness of our approach, has been implemented in Curry itself.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2007

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Albert, E., Hanus, M., Huch, F., Olvier, J. and Vidal, G. 2005. Operational Semantics for Declarative Multi-Paradigm Languages. Journal of Symbolic Computation 40, 1, 795829.Google Scholar
Albert, E., Hanus, M. and Vidal, G. 2002. A Practical Partial Evaluation Scheme for Multi-Paradigm Declarative Languages. Journal of Functional and Logic Programming 2002, 1.Google Scholar
Albert, E., Hanus, M. and Vidal, G. 2003. A Residualizing Semantics for the Partial Evaluation of Functional Logic Programs. Information Processing Letters 85, 1, 1925.Google Scholar
Albert, E. and Vidal, G. 2002. The Narrowing-Driven Approach to Functional Logic Program Specialization. New Generation Computing 20, 1, 326.CrossRefGoogle Scholar
Alpuente, M., Falaschi, M. and Vidal, G. 1998. Partial Evaluation of Functional Logic Programs. ACM TOPLAS 20, 4, 768844.CrossRefGoogle Scholar
Antoy, S. 1992. Definitional trees. In Proc. of the 3rd Int'l Conference on Algebraic and Logic Programming (ALP'92). Springer LNCS 632, 143157.Google Scholar
Antoy, S., Echahed, R. and Hanus, M. 2000. A Needed Narrowing Strategy. Journal of the ACM 47, 4, 776822.Google Scholar
Baader, F. and Nipkow, T. 1998. Term Rewriting and All That. Cambridge University Press.CrossRefGoogle Scholar
Biswas, S. 1997. Dynamic Slicing in Higher-Order Programming Languages. Ph.D. thesis, University of Pennsylvania.Google Scholar
Blazy, S. and Facon, P. 1998. Partial Evaluation for Program Comprehension. ACM Computing Surveys 30, 3es.CrossRefGoogle Scholar
Brassel, B., Hanus, M., Huch, F. and Vidal, G. 2004. A Semantics for Tracing Declarative Multi-Paradigm Programs. In Proc. of the 6th ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP'04). ACM Press, 179190.Google Scholar
Chitil, O. 2004. Source-Based Trace Exploration. In In Draft Proc. of the 16th Int'l Workshop on Implementation of Functional Languages (IFL 2004). Technical Report 0408, University of Kiel, 239244.Google Scholar
Ferrante, J., Ottenstein, K. and Warren, J. 1987. The Program Dependence Graph and Its Use in Optimization. ACM Transactions on Programming Languages and Systems 9, 3, 319349.Google Scholar
Field, J. and Tip, F. 1998. Dynamic Dependence in Term Rewriting Systems and its Application to Program Slicing. Information and Software Technology 40, 11–12, 609634.CrossRefGoogle Scholar
Gallagher, J. 1993. Tutorial on Specialisation of Logic Programs. In Proc. of the ACM Symp. on Partial Evaluation and Seman-tics-Based Program Manipulation (PEPM'93). ACM, New York, 8898.Google Scholar
Giovannetti, E., Levi, G., Moiso, C. and Palamidessi, C. 1991. Kernel Leaf: A Logic plus Functional Language. Journal of Computer and System Sciences 42, 363377.Google Scholar
Glück, R. and Sørensen, M. 1996. A Roadmap to Metacomputation by Supercompilation. In Partial Evaluation, Int'l Seminar, Dagstuhl Castle, Germany, Danvy, O., Glück, R., and Thiemann, P., Eds. Springer LNCS 1110, 137160.Google Scholar
Gyimóthy, T. and Paakki, J. 1995. Static Slicing of Logic Programs. In Proc. of the 2nd Int'l Workshop on Automated and Algorithmic Debugging (AADEBUG'95). IRISA-CNRS, 87103.Google Scholar
Hallgren, T. 2003. Haskell Tools from the Programatica Project. In Proc. of the 2003 ACM SIGPLAN Haskell Workshop. ACM Press, 103106.CrossRefGoogle Scholar
Hanus, M. 1994. The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming 19&20, 583628.CrossRefGoogle Scholar
Hanus, M. 1997. A Unified Computation Model for Functional and Logic Programming. In Proc. of ACM Symp. on Principles of Programming Languages (POPL'97). ACM, New York, 8093.Google Scholar
Hanus, M. 2003. Curry: An Integrated Functional Logic Language. Available at: http://www.informatik.uni-kiel.de/mh/curry/.Google Scholar
Hanus, M., Antoy, S., Engelke, M., Höppner, K., Koj, J., Niederau, P., Sadre, R. and Steiner, F. 2004. PAKCS 1.6.0: The Portland Aachen Kiel Curry System User Manual. Tech. rep., University of Kiel, Germany.Google Scholar
Hanus, M. and Prehofer, C. 1999. Higher-Order Narrowing with Definitional Trees. Journal of Functional Programming 9, 1, 3375.Google Scholar
Harman, M. and Danicic, S. 1997. Amorphous Program Slicing. In Proc. of the 5th Int'l Workshop on Program Comprehension. IEEE Computer Society Press.Google Scholar
Harman, M., Danicic, S. and Sivagurunathan, Y. 1995. Program Comprehension Assisted by Slicing and Transformation. In Proc. of the 1st UK Program Comprehension Workshop.Google Scholar
Harman, M. and Hierons, R. 2001. An Overview of Program Slicing. Software Focus 2, 3, 8592.CrossRefGoogle Scholar
Hortalá-González, T. and Ullán, E. 2001. An Abstract Machine Based System for a Lazy Narrowing Calculus. In Proc. of the 5th Int'l Symp. on Functional and Logic Programming (FLOPS 2001). Springer LNCS 2024, 216232.Google Scholar
Huet, G. and Lévy, J. 1992. Computations in orthogonal rewriting systems, Part I + II. In Computational Logic – Essays in Honor of Alan Robinson, Lassez, J. and Plotkin, G., Eds. 395443.Google Scholar
Jones, N., Gomard, C. and Sestoft, P. 1993. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ.Google Scholar
Klop, J. 1992. Term Rewriting Systems. In Handbook of Logic in Computer Science, Abramsky, S., Gabbay, D., and Maibaum, T., Eds. Vol. I. Oxford University Press, 1112.Google Scholar
Kuck, D., Kuhn, R., Padua, D., Leasure, B. and Wolfe, M. 1981. Dependence Graphs and Compiler Optimization. In Proc. of the 8th Symp. on the Principles of Programming Languages (POPL'81), SIGPLAN Notices. 207218.Google Scholar
Larsen, L. and Harrold, M. J. 1996. Slicing object-oriented software. In Proc. of the 18th Int'l Conf. on Software engineering (ICSE'96). IEEE Computer Society, 495505.Google Scholar
Leuschel, M. 2002. Homeomorphic Embedding for Online Termination of Symbolic Methods. In The Essence of Computation, Complexity, Analysis, Transformation. Essays Dedicated to Neil D. Jones. Springer LNCS 2566, 379403.Google Scholar
Leuschel, M. and Sørensen, M. 1996. Redundant Argument Filtering of Logic Programs. In Proc. of the Int'l Workshop on Logic-Based Program Synthesis and Transformation (LOPSTR'96). Springer LNCS 1207, 83103.Google Scholar
Leuschel, M. and Vidal, G. 2005. Forward Slicing by Conjunctive Partial Deduction and Argument Filtering. In Proc. of the European Symposium on Programming (ESOP 2005). Springer LNCS 3444, 6176.Google Scholar
Lloyd, J. 1994. Combining Functional and Logic Programming Languages. In Proc. of the International Logic Programming Symposium. 4357.Google Scholar
Loogen, R., López-Fraguas, F. and Rodríguez-Artalejo, M. 1993. A Demand Driven Computation Strategy for Lazy Narrowing. In Proc. of PLILP'93. Springer LNCS 714, 184200.Google Scholar
López-Fraguas, F. and Sánchez-Hernández, J. 1999. TOY: A Multiparadigm Declarative System. In Proc. of RTA'99. Springer LNCS 1631, 244247.Google Scholar
Moreno-Navarro, J. and Rodríguez-Artalejo, M. 1992. Logic Programming with Functions and Predicates: The language Babel. Journal of Logic Programming 12, 3, 191224.CrossRefGoogle Scholar
Ochoa, C., Silva, J. and Vidal, G. 2004. Dynamic Slicing Based on Redex Trails. In Proc. of the ACM SIGPLAN 2004 Symposium on Partial Evaluation and Program Manipulation (PEPM'04). ACM Press, 123134.Google Scholar
Reps, T. and Turnidge, T. 1996. Program Specialization via Program Slicing. In Partial Evaluation. Dagstuhl Castle, Germany, February 1996, Danvy, O., Glück, R., and Thiemann, P., Eds. Springer LNCS 1110, 409429.Google Scholar
Schoenig, S. and Ducasse, M. 1996. A Backward Slicing Algorithm for Prolog. In Proc. of the Int'l Static Analysis Symposium (SAS'96). Springer LNCS 1145, 317331.Google Scholar
Sestoft, P. 1997. Deriving a Lazy Abstract Machine. Journal of Functional Programming 7, 3, 231264.Google Scholar
Shapiro, E. 1983. Algorithmic Program Debugging. MIT Press, Cambridge, MA.Google Scholar
Silva, J. and Vidal, G. 2006. Forward Slicing of Functional Logic Programs by Partial Evaluation. Computing Research Repository (CoRR) at http://arXiv.org/abs/cs.PL/0601013/.Google Scholar
Sørensen, M., Glück, R. and Jones, N. 1996. A Positive Supercompiler. Journal of Functional Programming 6, 6, 811838.CrossRefGoogle Scholar
Steindl, C. 1998. Intermodular Slicing of Object-oriented Programs. In Proc. of the 7th Int'l Conf. on Compiler Construction (CC'98). Springer LNCS 1383, 264279.Google Scholar
Terese. 2003. Term Rewriting Systems. Cambridge University Press.Google Scholar
Tip, F. 1995. A Survey of Program Slicing Techniques. Journal of Programming Languages 3, 121189.Google Scholar
Tip, F., Choi, J.-D., Field, J. and Ramalingam, G. 1996. Slicing class hierarchies in C++. SIGPLAN Notices 31, 10, 179197.Google Scholar
Turchin, V. 1986. The Concept of a Supercompiler. ACM Transactions on Programming Languages and Systems 8, 3 (July), 292325.Google Scholar
Venkatesh, G. 1991. The Semantic Approach to Program Slicing. SIGPLAN Notices 26, 6, 107119. Proc. of the ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI'91).Google Scholar
Weiser, M. 1979. Program Slices: Formal, Psychological, and Practical Investigations of an Automatic Program Abstraction Method. Ph.D. thesis, The University of Michigan.Google Scholar
Weiser, M. 1984. Program Slicing. IEEE Transactions on Software Engineering 10, 4, 352357.CrossRefGoogle Scholar
Woodward, M. R. and Allen, S. P. 1998. Slicing algebraic specifications. Information and Software Technology 40, 2, 105118.CrossRefGoogle Scholar
Zhao, J., Cheng, J. and Ushijima, K. 2001. A Program Dependence Model for Concurrent Logic Programs and Its Applications. In Proc. of IEEE Int'l Conf. on Software Maintenance (ICSM'01). IEEE Press, 672681.Google Scholar