A New Module System for Prolog

  • Daniel Cabeza
  • Manuel Hermenegildo
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1861)


It is now widely accepted that separating programs into modules is useful in program development and maintenance. While many Prolog implementations include useful module systems, we argue that these systems can be improved in a number of ways, such as, for example, being more amenable to effective global analysis and transformation and allowing separate compilation or sensible creation of standalone executables. We discuss a number of issues related to the design of such an improved module system for Prolog and propose some novel solutions. Based on this, we present the choices made in the Ciao module system, which has been designed to meet a number of objectives: allowing separate compilation, extensibility in features and in syntax, amenability to modular global analysis and transformation, enhanced error detection, support for meta-programming and higher-order, compatibility to the extent possible with official and de-facto standards, etc.


Modules Modular Program Processing Global Analysis and Transformation Separate Compilation Prolog Ciao-Prolog 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    H. Aït-Kaci, A. Podelski, and G. Smolka. A feature-based constraint system for logic programming with entailment. In Proc. Fifth Generation Computer Systems 1992, pages 1012–1021, 1992.Google Scholar
  2. 2.
    F. Bueno, D. Cabeza, M. Carro, M. Hermenegildo, P. López-García, and G. Puebla. The Ciao Prolog System. Reference Manual. TR CLIP3/97.1, School of Computer Science, Technical University of Madrid (UPM), August 1997.Google Scholar
  3. 3.
    F. Bueno, D. Cabeza, M. Hermenegildo, and G. Puebla. Global Analysis of Standard Prolog Programs. In European Symposium on Programming, number 1058 in LNCS, pages 108–124, Sweden, April 1996. Springer-Verlag.Google Scholar
  4. 4.
    F. Bueno, M. García de la Banda, and M. Hermenegildo. Effectiveness of Abstract Interpretation in Automatic Parallelization: A Case Study in Logic Programming. ACM Trans. on Programming Languages and Systems, 21(2): 189–238, March 1999.Google Scholar
  5. 5.
    F. Bueno, P. Deransart, W. Drabent, G. Ferrand, M. Hermenegildo, J. Maluszynski, and G. Puebla. On the Role of Semantic Approximations in Validation and Diagnosis of Constraint Logic Programs. In Int’l WS on Automated Debugging-AADEBUG’97, pages 155–170, Sweden, May 1997. U. of Linköping Press.Google Scholar
  6. 6.
    D. Cabeza and M. Hermenegildo. Higher-order Logic Programming in Ciao. TR CLIP7/99.0, Facultad de Informática, UPM, September 1999.Google Scholar
  7. 7.
    D. Cabeza and M. Hermenegildo. The Ciao Modular Compiler and Its Generic Program Processing Library. In ICLP’99 WS on Parallelism and Implementation of (C)LP Systems, pages 147–164. N.M. State U., December 1999.Google Scholar
  8. 8.
    M. Carlsson and J. Widen. Sicstus Prolog User’s Manual. Po Box 1263, S-16313 Spanga, Sweden, April 1994.Google Scholar
  9. 9.
    W. Chen. A theory of modules based on second-order logic. In Proc. 4th IEEE Internat. Symposium on Logic Programming, pages 24–33, San Francisco, 1987.Google Scholar
  10. 10.
    M. Comini, G. Levi, M. C. Meo, and G. Vitiello. Proving properties of logic programs by abstract diagnosis. In M. Dams, editor, Analysis and Verification of Multiple-Agent Languages, 5th LOMAPS Workshop, number 1192 in Lecture Notes in Computer Science, pages 22–50. Springer-Verlag, 1996.Google Scholar
  11. 11.
    S. Debray. Flow analysis of dynamic logic programs. Journal of Logic Programming, 7(2):149–176, September 1989.Google Scholar
  12. 12.
    P. Deransart, A. Ed-Dbali, and L. Cervoni. Prolog: The Standard. Springer, 1996.Google Scholar
  13. 13.
    J.A. Goguen and J. Meseguer. Eqlog: equality, types, and generic modules for logic programming. In Logic Programming: Functions, Relations, and Equations, Englewood Cliffs, 1986. Prentice-Hall.Google Scholar
  14. 14.
    M. Hermenegildo. A Documentation Generator for (C)LP Systems. In this volume: Proceedings of CL2000, LNCS, Springer-Verlag.Google Scholar
  15. 15.
    M. Hermenegildo, F. Bueno, G. Puebla, and P. López-García. Program Analysis, Debugging and Optimization Using the Ciao System Preprocessor. In Proc. of ICLP’99, pages 52–66, Cambridge, MA, November 1999. MIT Press.Google Scholar
  16. 16.
    M. Hermenegildo and The CLIP Group. Programming with Global Analysis. In Proc. of ILPS’97, pages 49–52, October 1997. MIT Press. (Invited talk abstract).Google Scholar
  17. 17.
    M. Hermenegildo, G. Puebla, and F. Bueno. Using Global Analysis, Partial Specifications, and an Extensible Assertion Language for Program Validation and Debugging. In K. R. Apt, V. Marek, M. Truszczynski, and D. S. Warren, editors, The Logic Programming Paradigm: a 25-Year Perspective, pages 161–192. Springer-Verlag, July 1999.Google Scholar
  18. 18.
    P. Hill and J. Lloyd. The Goedel Programming Language. MIT Press, 1994.Google Scholar
  19. 19.
    International Organization for Standardization. PROLOG. ISO/IEC DIS 13211 — Part 1: General Core, 1994.Google Scholar
  20. 20.
    International Organization for Standardization. PROLOG. Working Draft 7.0 X3J17/95/1 — Part 2: Modules, 1995.Google Scholar
  21. 21.
    D. Miller. A logical analysis of modules in logic programming. Journal of Logic Programming, pages 79–108, 1989.Google Scholar
  22. 22.
    L. Monteiro and A. Porto. Contextual logic programming. In Proc. of ICLP’89, pages 284–299. MIT Press, Cambridge, MA, 1989.Google Scholar
  23. 23.
    R.A. O’Keefe. Towards an algebra for constructing logic programs. In IEEE Symposium on Logic Programming, pages 152–160, Boston, Massachusetts, July 1985. IEEE Computer Society.Google Scholar
  24. 24.
    A. Pineda and M. Hermenegildo. O’ciao: An Object Oriented Programming Model for (Ciao) Prolog. TR CLIP 5/99.0, Facultad de Inform’atica, UPM, July 1999.Google Scholar
  25. 25.
    G. Puebla, F. Bueno, and M. Hermenegildo. An Assertion Language for Debugging of Constraint Logic Programs. In ILPS’97 WS on Tools and Environments for (C)LP, October 1997. Available as TR CLIP2/97.1 from
  26. 26.
    G. Puebla, F. Bueno, and M. Hermenegildo. An Assertion Language for Debugging of Constraint Logic Programs. In Analysis and Visualization Tools for Constraint Programming, LNCS. Springer-Verlag, 2000. To appear.Google Scholar
  27. 27.
    G. Puebla and M. Hermenegildo. Some Issues in Analysis and Specialization of Modular Ciao-Prolog Programs. In ICLP’99 WS on Optimization and Implementation of Declarative Languages, pages 45–61. U. of Southampton, U.K, Nov. 1999.Google Scholar
  28. 28.
    Quintus Prolog User’s Guide and Reference Manual—Version 6, April 1986.Google Scholar
  29. 29.
    K. Sagonas, T. Swift, and D.S. Warren. The XSB Programming System. In ILPS WS on Programming with Logic Databases, TR #1183, pages 164–164. U. of Wisconsin, October 1993.Google Scholar
  30. 30.
    Z. Somogyi, F. Henderson, and T. Conway. The execution algorithm of Mercury: an efficient purely declarative LP language. JLP, 29(1–3), October 1996.Google Scholar
  31. 31.
    A. Taylor. High performance prolog implementation through global analysis. Slides of the invited talk at PDK’91, Kaiserslautern, 1991.Google Scholar
  32. 32.
    P. Van Roy, B. Demoen, and Y. D. Willems. Improving the Execution Speed of Compiled Prolog with Modes, Clause Selection, and Determinism. In Proceedings of TAPSOFT’ 87, LNCS. Springer-Verlag, March 1987.Google Scholar
  33. 33.
    P. Van Roy and A.M. Despain. High-Performace Logic Programming with the Aquarius Prolog Compiler. IEEE Computer Magazine, pages 54–68, January 1992.Google Scholar
  34. 34.
    D.S. Warren and W. Chen. Formal semantics of a theory of modules. TR 87/11, SUNY at Stony Brook, 1987.Google Scholar
  35. 35.
    R. Warren, M. Hermenegildo, and S. K. Debray. On the Practicality of Global Flow Analysis of Logic Programs. In Fifth International Conference and Symposium on Logic Programming, pages 684–699. MIT Press, August 1988.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Daniel Cabeza
    • 1
  • Manuel Hermenegildo
    • 1
  1. 1.Department of Computer ScienceTechnical U. of Madrid (UPM)Spain

Personalised recommendations