Abstract

Program slicing provides explanations that illustrate how program outputs were produced from inputs. We build on an approach introduced in prior work, where dynamic slicing was defined for pure higher-order functional programs as a Galois connection between lattices of partial inputs and partial outputs. We extend this approach to imperative functional programs that combine higher-order programming with references and exceptions. We present proofs of correctness and optimality of our approach and a proof-of-concept implementation and experimental evaluation.

Highlights

  • When a program produces an unexpected result, experienced programmers often intuitively łrun the program backwardsž to identify the last part of the program that contributed to the output, to decide where to focus attention to find the bug

  • In the following ML-like program: let f(x) = if (x == 0) y := 6 * !z else (y := 84 / !z; w := g(!y + 12)) suppose we observe, on applying f to some argument, that afterwards !y has the value 42, when we were expecting some other value

  • Perera et al [2012] introduced a new approach to dynamic slicing for functional programs where the slicing criteria take the form of partial values, allowing for fine-grained slicing particular to specific sub-values

Read more

Summary

INTRODUCTION

If we shade elided parts of the program, one possible slice with respect to output observation !y = 42 is: let f(x) = if (x == 0) y := 6 * !z else (y := 84 / !z; w := g(!y + 12)) This slice shows that the Division_by_zero exception was raised and handled (so !z must have been 0). Perera et al [2012] introduced a new approach to dynamic slicing for (pure) functional programs where the slicing criteria take the form of partial values, allowing for fine-grained slicing particular to specific sub-values In this approach, input and output values may be partly elided in the same way as program slices, with holes (written □) intuitively corresponding to parts of programs or. The main contribution of this paper is showing how to make the above intuitions precise and extend the Galois connection approach to higher-order programming with effects

Contributions and Outline
BACKGROUND
Galois Connections for Slicing
Summary
CORE CALCULUS AND COMMON CONCEPTS
Result
Partial Expressions and Partial Computations
SLICING FOR REFERENCES AND EXCEPTIONS
Forward Slicing
Backward Slicing
IMPLEMENTATION
RELATED WORK
CONCLUSIONS
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call