Skip to main content

Generic Cut Actions for External Prolog Predicates

  • Conference paper
Practical Aspects of Declarative Languages (PADL 2006)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3819))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Warren, D.H.D.: An Abstract Prolog Instruction Set. Technical Note 309, SRI International (1983)

    Google Scholar 

  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. Santos Costa, V.: Optimising Bytecode Emulation for Prolog. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 261–267. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  4. Widenius, M., Axmark, D.: MySQL Reference Manual: Documentation from the Source. O’Reilly Community Press, Sebastopol (2002)

    Google Scholar 

  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. 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. 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. 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. Wielemaker, J.: SWI-Prolog Reference Manual, Available from, http://www.swi-prolog.org+

    Google Scholar 

  10. Santos Costa, V., Damas, L., Reis, R., Azevedo, R.: YAP User’s Manual, Available from, http://www.ncc.up.pt/~vsc/Yap

  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 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Soares, T., Rocha, R., Ferreira, M. (2005). Generic Cut Actions for External Prolog Predicates. In: Van Hentenryck, P. (eds) Practical Aspects of Declarative Languages. PADL 2006. Lecture Notes in Computer Science, vol 3819. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11603023_2

Download citation

  • DOI: https://doi.org/10.1007/11603023_2

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-30947-5

  • Online ISBN: 978-3-540-31685-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics