Abstract
We present a new approach to a technique known as compiling control, whose aim is to compile away special mechanisms for non-standard atom selection in logic programs. It has previously been conjectured that compiling control could be implemented as an instance of the first Futamura projection, in which an interpreter is specialized for an input program. However, the exact nature of such an interpreter and of the required technique for specialization were never specified. In this work, we propose a Prolog meta-interpreter which applies the desired non-standard selection rule and which is amenable to specialization using offline partial deduction. After the initial analysis phase of compiling control, we collect annotations to specialize the interpreter using the Logen system for offline partial deduction. We also show that the result of the specialization is equivalent to the program obtained using the traditional approach to compiling control. In this way, we simplify the synthesis step.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
Both assumptions pertaining to fully evaluated atoms are strictly for notational convenience.
- 2.
We use “partial evaluation” rather than “partial deduction” for impure logic programs.
- 3.
In the most recent work on the analysis [6], we have assumed the pattern of a \(multi\) to be a conjunction. Known examples of other patterns are artificial. One is provided in the appendix.
- 4.
With the exception of the postprocessed classical synthesis of the prime sieve. This suggests a bug in ECCE, but the numbers before postprocessing are still within 16.5%.
References
Bruynooghe, M., Schreye, D.D., Krekels, B.: Compiling control. In: Proceedings of the 1986 Symposium on Logic Programming, Salt Lake City, 22–25 September 1986, pp. 70–77. IEEE-CS (1986)
Bruynooghe, M., Schreye, D.D., Krekels, B.: Compiling control. J. Log. Program. 6(1&2), 135–162 (1989)
Bruynooghe, M.: A practical framework for the abstract interpretation of logic programs. J. Log. Program. 10(2), 91–124 (1991)
Komorowski, H.J.: A specification of an abstract Prolog machine and its application to partial evaluation. Ph.D. thesis, VTT Grafiska (1981)
Gallagher, J.P.: Transforming logic programs by specialising interpreters. In: ECAI, vol. I, pp. 313–326 (1986)
Nys, V., De Schreye, D.: Abstract conjunctive partial deduction for the analysis and compilation of coroutines. Formal Aspects Comput. 29(1), 125–153 (2017)
Leuschel, M.: A framework for the integration of partial evaluation and abstract interpretation of logic programs. ACM Trans. Program. Lang. Syst. 26(3), 413–463 (2004)
Gómez-Zamalloa, M., Albert, E., Puebla, G.: Decompilation of Java bytecode to prolog by partial evaluation. Inf. Softw. Technol. 51(10), 1409–1427 (2009)
Henriksen, K.S., Gallagher, J.P.: Abstract interpretation of PIC programs through logic programming. In: Sixth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2006), 27–29 September 2006, Philadelphia, pp. 184–196. IEEE Computer Society (2006)
Leuschel, M., Craig, S.J., Bruynooghe, M., Vanhoof, W.: Specialising interpreters using offline partial deduction. In: Bruynooghe, M., Lau, K.-K. (eds.) Program Development in Computational Logic: A Decade of Research Advances in Logic-Based Program Development. LNCS, vol. 3049, pp. 340–375. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-25951-0_11
Futamura, Y.: Partial evaluation of computation process-an approach to a compiler-compiler. Higher-Order Symb. Comput. 12(4), 381–391 (1999)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial evaluation and automatic program generation. In: Prentice Hall International Series in Computer Science. Prentice Hall (1993)
Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. J. Log. Program. 11(3&4), 217–242 (1991)
Leuschel, M., Bruynooghe, M.: Logic program specialisation through partial deduction: control issues. TPLP 2(4–5), 461–515 (2002)
Leuschel, M., Jørgensen, J., Vanhoof, W., Bruynooghe, M.: Offline specialisation in prolog using a hand-written compiler generator. CoRR cs.PL/0208009 (2002)
Craig, S.-J., Gallagher, J.P., 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). https://doi.org/10.1007/11506676_4
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Nys, V., De Schreye, D. (2019). Compiling Control as Offline Partial Deduction. In: Mesnard, F., Stuckey, P. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2018. Lecture Notes in Computer Science(), vol 11408. Springer, Cham. https://doi.org/10.1007/978-3-030-13838-7_7
Download citation
DOI: https://doi.org/10.1007/978-3-030-13838-7_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-13837-0
Online ISBN: 978-3-030-13838-7
eBook Packages: Computer ScienceComputer Science (R0)