Error-Correcting Source Code

  • Authors:
  • Yasuhiro Ajiro;Kazunori Ueda;Kenta Cho

  • Affiliations:
  • -;-;-

  • Venue:
  • CP '98 Proceedings of the 4th International Conference on Principles and Practice of Constraint Programming
  • Year:
  • 1998

Quantified Score

Hi-index 0.01

Visualization

Abstract

We study how constraint-based static analysis can be applied to the automated and systematic debugging of program errors. Strongly moding and constraint-based mode analysis are turning to play fundamental roles in debugging concurrent logic/constraint programs as well as in establishing the consistency of communication protocols and in optimization. Mode analysis of Moded Flat GHC is a constraint satisfaction problem with many simple mode constraints, and can be solved efficiently by unification over feature graphs. We have proposed a simple and efficient technique which, given a non-well-moded program, diagnoses the "reasons" of inconsistency by finding minimal inconsistent subsets of mode constraints. Since each constraint keeps track of the symbol occurrence in the program that imposed the constraint, a minimal subset also tells possible sources of program errors. The technique is quite general and can be used with other constraint-based frameworks such as strong typing. Based on the above idea, we study the possibility of automated debugging in the absence of mode/type declarations. The mode constraints are usually imposed redundantly, and the constraints that are considered correct can be used for correcting wrong symbol occurrences found by the diagnosis. As long as bugs are near-misses, the automated debugger can propose a rather small number of alternatives that include the intended program. Search space is kept small because constraints effectively prune many irrelevant alternatives. The paper demonstrates the technique by way of examples.