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).
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Alpuente, M., Falaschi, M., Vidal, G.: Partial Evaluation of Functional Logic Programs. ACM Transactions on Programming Languages and Systems 20(4), 768–844 (1998)
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)
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)
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)
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)
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)
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)
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)
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)
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)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)
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)
Leuschel, M.: The ECCE partial deduction system and the DPPD library of benchmarks (1996-2002), Obtainable via, http://www.ecs.soton.ac.uk/~mal
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)
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)
Leuschel, M., Bruynooghe, M.: Logic program specialisation through partial deduction: Control issues. Theory and Practice of Logic Programming 2(4-5), 461–515 (2002)
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)
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)
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)
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)
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)
Lloyd, J.W.: Foundations of Logic Programming. Springer, Heidelberg (1987)
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)
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)
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)
Sahlin, D.: Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing 12(1), 7–51 (1993)
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)
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)
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Rights 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)