Generic Cut Actions for External Prolog Predicates

  • Tiago Soares
  • Ricardo Rocha
  • Michel Ferreira
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3819)

Abstract

An interesting feature of current Prolog systems is the ability to define external Prolog predicates that can be written in other languages. However, an important drawback of these interfaces is the fact that they lack some important features necessary to improve both the efficiency and the transparent integration of the Prolog system and the external predicates. Such an example is the cut operation. This operation is used quite often in Prolog programs, both for efficiency and semantic preservation. However, its use after a call to an externally defined predicate can have undesired effects. For example, if we have a pending connection to another application, or if we have memory blocks allocated by an external predicate, when a cut operation occurs, we may not be able to perform generic destruct actions, such as closing the pending connection or freeing the unnecessary memory. In this work, we propose an extension of the interface architecture that allows to associate generic user-defined functions with external predicates, in such a way that the Prolog engine transparently executes them when a cut operation occurs. We describe the implementation details of our proposal in the context of the Yap Prolog system.

Keywords

Prolog Systems Implementation External Modules Pruning 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Warren, D.H.D.: An Abstract Prolog Instruction Set. Technical Note 309, SRI International (1983)Google Scholar
  2. 2.
    Ferreira, M., Rocha, R., Silva, S.: Comparing Alternative Approaches for Coupling Logic Programming with Relational Databases. In: Colloquium on Implementation of Constraint and LOgic Programming Systems, pp. 71–82 (2004)Google Scholar
  3. 3.
    Santos Costa, V.: Optimising Bytecode Emulation for Prolog. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 261–267. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  4. 4.
    Widenius, M., Axmark, D.: MySQL Reference Manual: Documentation from the Source. O’Reilly Community Press, Sebastopol (2002)Google Scholar
  5. 5.
    Rocha, R., Silva, F., Santos Costa, V.: YapTab: A Tabling Engine Designed to Support Parallelism. In: Conference on Tabulation in Parsing and Deduction, pp. 77–87 (2000)Google Scholar
  6. 6.
    Sagonas, K., Swift, T., Warren, D.S.: XSB as an Efficient Deductive Database Engine. In: ACM SIGMOD International Conference on the Management of Data, pp. 442–453. ACM Press, New York (1994)Google Scholar
  7. 7.
    Sagonas, K., Warren, D.S., Swift, T., Rao, P., Dawson, S., Freire, J., Johnson, E., Cui, B., Kifer, M., Demoen, B., Castro, L.F.: XSB Programmers’ Manual Available from, http://xsb.sourceforge.net
  8. 8.
    Bueno, F., Cabeza, D., Carro, M., Hermenegildo, M., López, P., Puebla, G.: Ciao Prolog System Manual, Available from, http://clip.dia.fi.upm.es/Software/Ciao+
  9. 9.
    Wielemaker, J.: SWI-Prolog Reference Manual, Available from, http://www.swi-prolog.org+ Google Scholar
  10. 10.
    Santos Costa, V., Damas, L., Reis, R., Azevedo, R.: YAP User’s Manual, Available from, http://www.ncc.up.pt/~vsc/Yap
  11. 11.
    Draxler, C.: Accessing Relational and NF2 Databases Through Database Set Predicates. In: UK Annual Conference on Logic Programming. Workshops in Computing, pp. 156–173. Springer, Heidelberg (1992)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Tiago Soares
    • 1
  • Ricardo Rocha
    • 1
  • Michel Ferreira
    • 1
  1. 1.DCC-FC & LIACCUniversity of PortoPortoPortugal

Personalised recommendations