Tabling in mercury: design and implementation

  • Authors:
  • Zoltan Somogyi;Konstantinos Sagonas

  • Affiliations:
  • NICTA Victoria Laboratory, Department of Computer Science and Software Engineering, University of Melbourne, Australia;Department of Information Technology, Uppsala University, Sweden

  • Venue:
  • PADL'06 Proceedings of the 8th international conference on Practical Aspects of Declarative Languages
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

For any LP system, tabling can be quite handy in a variety of tasks, especially if it is efficiently implemented and fully integrated in the language. Implementing tabling in Mercury poses special challenges for several reasons. First, Mercury is both semantically and culturally quite different from Prolog. While decreeing that tabled predicates must not include cuts is acceptable in a Prolog system, it is not acceptable in Mercury, since if-then-elses and existential quantification have sound semantics for stratified programs and are used very frequently both by programmers and by the compiler. The Mercury implementation thus has no option but to handle interactions of tabling with Mercury’s language features safely. Second, the Mercury implementation is vastly different from the WAM, and many of the differences (e.g. the absence of a trail) have significant impact on the implementation of tabling. In this paper, we describe how we adapted the copying approach to tabling to implement tabling in Mercury.