Skip to main content

Supervising Offline Partial Evaluation of Logic Programs Using Online Techniques

  • Conference paper
Logic-Based Program Synthesis and Transformation (LOPSTR 2006)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4407))

Abstract

A major impediment for more widespread use of offline partial evaluation is the difficulty of obtaining and maintaining annotations for larger, realistic programs. Existing automatic binding-time analyses still only have limited applicability and annotations often have to be created or improved and maintained by hand, leading to errors. We present a technique to help overcome this problem by using online control techniques which supervise the specialisation process in order to detect such errors. We discuss an implementation in the logen system and show on a series of examples that this approach is effective: very few false alarms were raised while infinite loops were detected quickly. We also present the integration of this technique into a web interface, which highlights problematic annotations directly in the source code. A method to automatically fix incorrect annotations is presented, allowing the approach to be also used as a pragmatic binding time analysis. Finally we show how our method can be used for efficiently locating errors with built-ins inside Prolog source code.

This research has been carried out as part of the EU funded project IST-2001-38059 ASAP (Advanced Specialization and Analysis for Pervasive Systems).

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. Alpuente, M., Falaschi, M., Vidal, G.: Partial Evaluation of Functional Logic Programs. ACM Transactions on Programming Languages and Systems 20(4), 768–844 (1998)

    Article  Google Scholar 

  2. Barker, S., Leuschel, M., Varea, M.: Efficient and flexible access control via logic program specialisation. In: Proceedings PEPM’04, pp. 190–199. ACM Press, New York (2004)

    Google Scholar 

  3. Bondorf, A.: Towards a self-applicable partial evaluator for term rewriting systems. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, pp. 27–50. North-Holland, Amsterdam (1988)

    Google Scholar 

  4. Bruynooghe, M., De Schreye, D., Martens, B.: A general criterion for avoiding infinite unfolding during partial deduction. New Generation Computing 11(1), 47–79 (1992)

    MATH  Google Scholar 

  5. Bruynooghe, M., Leuschel, M., Sagonas, K.: A polyvariant binding-time analysis for off-line partial deduction. In: Hankin, C. (ed.) ESOP 1998 and ETAPS 1998. LNCS, vol. 1381, pp. 27–41. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  6. Christensen, N.H., Glück, R.: Offline partial evaluation can be as accurate as online partial evaluation. ACM Transactions on Programming Languages and Systems 26(1), 191–220 (2004)

    Article  Google Scholar 

  7. Consel, C.: Binding time analysis for high order untyped functional languages. In: LFP ’90: Proceedings of the 1990 ACM conference on LISP and functional programming, pp. 264–272. ACM Press, New York (1990)

    Chapter  Google Scholar 

  8. Craig, S.-J., Gallagher, J., Leuschel, M., Henriksen, K.S.: Fully automatic binding-time analysis for Prolog. In: Etalle, S. (ed.) LOPSTR 2004. LNCS, vol. 3573, pp. 53–68. Springer, Heidelberg (2005)

    Google Scholar 

  9. Glenstrup, A.J., Jones, N.D.: BTA algorithms to ensure termination of off-line partial evaluation. In: Bjorner, D., Broy, M., Pottosin, I.V. (eds.) Perspectives of System Informatics. LNCS, vol. 1181, pp. 273–284. Springer, Heidelberg (1996)

    Google Scholar 

  10. Henriksen, K.S., Gallagher, J.P.: Analysis and specialisation of a PIC processor. In: Proceedings of the IEEE International Conference on Systems, Man & Cybernetics (2), The Hague, The Netherlands, pp. 1131–1135. IEEE, Los Alamitos (2004)

    Google Scholar 

  11. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)

    MATH  Google Scholar 

  12. Lassez, J.-L., Maher, M., Marriott, K.: Unification revisited. In: Minker, J. (ed.) Foundations of Deductive Databases and Logic Programming, pp. 587–625. Morgan Kaufmann, San Francisco (1988)

    Google Scholar 

  13. Leuschel, M.: The ECCE partial deduction system and the DPPD library of benchmarks (1996-2002), Obtainable via, http://www.ecs.soton.ac.uk/~mal

  14. Leuschel, M.: On the power of homeomorphic embedding for online termination. In: Levi, G. (ed.) SAS 1998. LNCS, vol. 1503, pp. 230–245. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  15. Leuschel, M.: Homeomorphic embedding for online termination of symbolic methods. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 379–403. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  16. Leuschel, M., Bruynooghe, M.: Logic program specialisation through partial deduction: Control issues. Theory and Practice of Logic Programming 2(4-5), 461–515 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  17. Leuschel, M., Craig, S., Bruynooghe, M., Vanhoof, W.: Specializing interpreters using offline partial deduction. In: Bruynooghe, M., Lau, K.-K. (eds.) Program Development in Computational Logic. LNCS, vol. 3049, pp. 341–376. Springer, Heidelberg (2004)

    Google Scholar 

  18. Leuschel, M., Elphick, D., Varea, M., Craig, S., Fontaine, M.: The Ecce and Logen partial evaluators and their web interfaces. In: John Hatcliff, F.T. (ed.) Proceedings of PEPM’06, pp. 88–94. IBM Press (2006)

    Google Scholar 

  19. Leuschel, M., Jørgensen, J., Vanhoof, W., Bruynooghe, M.: Offline specialisation in Prolog using a hand-written compiler generator. Theory and Practice of Logic Programming 4(1), 139–191 (2004)

    Article  MATH  Google Scholar 

  20. Leuschel, M., Martens, B., De Schreye, D.: Controlling generalisation and polyvariance in partial deduction of normal logic programs. ACM Transactions on Programming Languages and Systems 20(1), 208–258 (1998)

    Article  Google Scholar 

  21. Leuschel, M., Vidal, G.: Forward slicing by conjunctive partial deduction and argument filtering. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 61–76. Springer, Heidelberg (2005)

    Google Scholar 

  22. Lloyd, J.W.: Foundations of Logic Programming. Springer, Heidelberg (1987)

    MATH  Google Scholar 

  23. Makholm, H.: On Jones-optimal specialization for strongly typed languages. In: Taha, W. (ed.) SAIG 2000. LNCS, vol. 1924, pp. 129–148. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  24. Martens, B., Gallagher, J.: Ensuring global termination of partial deduction while allowing flexible polyvariance. In: Sterling, L. (ed.) Proceedings ICLP’95, pp. 597–613. MIT Press, Cambridge (1995)

    Google Scholar 

  25. Pemmasani, G., Guo, H.-F., Dong, Y., Ramakrishnan, C.R., Ramakrishnan, I.V.: Online justification for tabled logic programs. In: Kameyama, Y., Stuckey, P.J. (eds.) FLOPS 2004. LNCS, vol. 2998, pp. 24–38. Springer, Heidelberg (2004)

    Google Scholar 

  26. Sahlin, D.: Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing 12(1), 7–51 (1993)

    Article  MATH  Google Scholar 

  27. Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of Mercury: An efficient purely declarative logic programming language. The Journal of Logic Programming 29(1–3), 17–64 (1996)

    Article  MATH  Google Scholar 

  28. Sørensen, M.H., Glück, R.: An algorithm of generalization in positive supercompilation. In: Lloyd, J.W. (ed.) Proceedings of ILPS’95, the International Logic Programming Symposium, Portland, USA, pp. 465–479. MIT Press, Cambridge (1995)

    Google Scholar 

  29. Sperber, M.: Self-applicable online partial evaluation. In: Danvy, O., Thiemann, P., Glück, R. (eds.) Partial Evaluation. LNCS, vol. 1110, pp. 465–480. Springer, Heidelberg (1996)

    Google Scholar 

  30. Vanhoof, W., Martens, B.: To parse or not to parse. In: Fuchs, N.E. (ed.) LOPSTR 1997. LNCS, vol. 1463, pp. 322–342. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  31. Wang, Q., Gupta, G., Leuschel, M.: Towards provably correct code generation via Horn logical continuation semantics. In: Hermenegildo, M.V., Cabeza, D. (eds.) Practical Aspects of Declarative Languages. LNCS, vol. 3350, pp. 98–112. Springer, Heidelberg (2005)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Germán Puebla

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer Berlin Heidelberg

About this paper

Cite this paper

Leuschel, M., Craig, SJ., Elphick, D. (2007). Supervising Offline Partial Evaluation of Logic Programs Using Online Techniques. In: Puebla, G. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2006. Lecture Notes in Computer Science, vol 4407. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-71410-1_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-71410-1_5

  • Publisher Name: Springer, Berlin, Heidelberg

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

  • Online ISBN: 978-3-540-71410-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics