Constraint-based mode analysis of mercury

  • Authors:
  • David Overton;Zoltan Somogyi;Peter J. Stuckey

  • Affiliations:
  • Monash University, Victoria, 3800, Australia;The University of Melbourne, Victoria, 3010, Australia;The University of Melbourne, Victoria, 3010, Australia

  • Venue:
  • Proceedings of the 4th ACM SIGPLAN international conference on Principles and practice of declarative programming
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recent logic programming languages, such as Mercury and HAL, require type, mode and determinism declarations for predicates. This information allows the generation of efficient target code and the detection of many errors at compile-time. Unfortunately, mode checking in such languages is difficult. One of the main reasons is that, for each predicate mode declaration, the compiler is required to decide which parts of the procedure bind which variables, and how conjuncts in the predicate definition should be re-ordered to enforce this behaviour. Current mode checking systems limit the possible modes that may be used because they do not keep track of aliasing information, and have only a limited ability to infer modes, since inference does not perform reordering. In this paper we develop a mode inference system for Mercury based on mapping each predicate to a system of Boolean constraints that describe where its variables can be produced. This allows us handle programs that are not supported by the existing system.