A Compiler Generator for Constraint Logic Programs

  • Stephen-John Craig
  • Michael Leuschel
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2890)


The cogen approach to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success. This paper demonstrates that the cogen approach is also applicable to the specialisation of constraint logic programs and leads to effective specialisers. We present the basic specialisation technique for CLP(Q) programs and show how we can handle non-declarative features as well. We present an implemented system along with experimental results.


Convex Hull Partial Evaluation Nonlinear Constraint Constraint Logic Programming Partial Evaluator 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Andersen, L.O.: Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen (May 1994) (DIKU report 94/19)Google Scholar
  2. 2.
    Beckman, L., Haraldson, A., Oskarsson, Ö., Sandewall, E.: A partial evaluator and its use as a programming tool. Artificial Intelligence 7, 319–357 (1976)zbMATHCrossRefGoogle Scholar
  3. 3.
    Birkedal, L., Welinder, M.: Hand-writing program generator generators. In: Hermenegildo, M., Penjam, J. (eds.) PLILP 1994. LNCS, vol. 844, pp. 198–214. Springer, Heidelberg (1994)Google Scholar
  4. 4.
    Fioravanti, F., Pettorossi, A., Proietti, M.: Automated strategies for specializing constraint logic programs. In: Lau, K.-K. (ed.) LOPSTR 2000. LNCS, vol. 2042, pp. 125–146. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  5. 5.
    Fioravanti, F., Pettorossi, A., Proietti, M.: Verifying ctl properties of infinite-state systems by specializing constraint logic programs. In: Proceedings of VCL 2001, Florence, Italy (September 2001)Google Scholar
  6. 6.
    Holst, C.K., Launchbury, J.: Handwriting cogen to avoid problems with static typing. In: Draft Proceedings, Fourth Annual Glasgow Workshop on Functional Programming, Skye, Scotland, pp. 210–218. Glasgow University (1991)Google Scholar
  7. 7.
    Holst, C.K.: Syntactic currying: yet another approach to partial evaluation. Technical report, DIKU, Department of Computer Science, University of Copenhagen (1989)Google Scholar
  8. 8.
    Jaffar, J., Michaylov, S., Yap, R.H.C.: A methodology for managing hard constraints in CLP systems. In: Proceedings of the ACM SIGPLAN 1991 Conference on Programming Language Design and Implementation, Toronto, Ontario, Canada, June 1991, vol. 26, pp. 306–316 (1991)Google Scholar
  9. 9.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)zbMATHGoogle Scholar
  10. 10.
    Leuschel, M.: The ecce partial deduction system and the dppd library of benchmarks. Obtainable via (1996-2002),
  11. 11.
    Leuschel, M., Jørgensen, J., Vanhoof, W., Bruynooghe, M.: Offline specialisation in Prolog using a hand-written compiler generator. In: Theory and Practice of Logic Programming, p. 52 (2003) (to appear)Google Scholar
  12. 12.
    Marriott, K., Stuckey, P.: The 3 r’s of optimizing constraint logic programs: Refinement, removal, and reordering. In: Proceedings of POPL 1993, pp. 334–344. ACM Press, New York (1993)CrossRefGoogle Scholar
  13. 13.
    Mesnard, F., Ruggieri, S.: On proving left termination of constraint logic programs. ACM Transactions on Computational Logic (2003) (to appear)Google Scholar
  14. 14.
    Peralta, J.C., Gallagher, J.P.: Convex hull abstractions in specialization of clp programs. In: Leuschel, M. (ed.) LOPSTR 2002. LNCS, vol. 2664. Springer, Heidelberg (2002)Google Scholar
  15. 15.
    Peralta, J.C.: Analysis and Specialisation of Imperative Programs: An approach using CLP. PhD thesis, Department of Computer Science, University of Bristol (2000)Google Scholar
  16. 16.
    Prestwich, S.: The PADDY partial deduction system. Technical Report ECRC- 92-6, ECRC, Munich, Germany (1992)Google Scholar
  17. 17.
    Romanenko, S.A.: A compiler generator produced by a self-applicable specializer can have a surprisingly natural and understandable structure. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, pp. 445–463. North-Holland, Amsterdam (1988)Google Scholar
  18. 18.
    Sahlin, D.: Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing 12(1), 7–51 (1993)zbMATHCrossRefGoogle Scholar
  19. 19.
    Smith, D.A.: Partial evaluation of pattern matching in constraint logic programming languages. In: Jones, N.D., Hudak, P. (eds.) ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation. Sigplan Notices 26(9), pp. 62–71. ACM Press, New York (1991)Google Scholar
  20. 20.
    Smith, D.A., Hickey, T.: Partial evaluation of a CLP language. In: Debray, S.K., Hermenegildo, M. (eds.) Proceedings of the North American Conference on Logic Programming, pp. 119–138. MIT Press, Cambridge (1990)Google Scholar
  21. 21.
    Tao, Y., Grosky, W., Liu, C.: An automatic partial deduction system for constraint logic programs. In: 9th International Conference on Tools with Artificial Intelligence (ICTAI 1997), Newport Beach, CA, USA, November 1997, pp. 149–157. IEEE Computer Society, Los Alamitos (1997)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Stephen-John Craig
    • 1
  • Michael Leuschel
    • 1
  1. 1.Department of Electronics and Computer ScienceUniversity of SouthamptonHighfield

Personalised recommendations