Skip to main content

Compiling Control as Offline Partial Deduction

  • Conference paper
  • First Online:

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

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

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 EPUB and 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

Learn about institutional subscriptions

Notes

  1. 1.

    Both assumptions pertaining to fully evaluated atoms are strictly for notational convenience.

  2. 2.

    We use “partial evaluation” rather than “partial deduction” for impure logic programs.

  3. 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. 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

  1. 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)

    Google Scholar 

  2. Bruynooghe, M., Schreye, D.D., Krekels, B.: Compiling control. J. Log. Program. 6(1&2), 135–162 (1989)

    Article  Google Scholar 

  3. Bruynooghe, M.: A practical framework for the abstract interpretation of logic programs. J. Log. Program. 10(2), 91–124 (1991)

    Article  MathSciNet  Google Scholar 

  4. Komorowski, H.J.: A specification of an abstract Prolog machine and its application to partial evaluation. Ph.D. thesis, VTT Grafiska (1981)

    Google Scholar 

  5. Gallagher, J.P.: Transforming logic programs by specialising interpreters. In: ECAI, vol. I, pp. 313–326 (1986)

    Google Scholar 

  6. Nys, V., De Schreye, D.: Abstract conjunctive partial deduction for the analysis and compilation of coroutines. Formal Aspects Comput. 29(1), 125–153 (2017)

    Article  MathSciNet  Google Scholar 

  7. 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)

    Article  Google Scholar 

  8. 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)

    Article  Google Scholar 

  9. 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)

    Google Scholar 

  10. 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

    Chapter  Google Scholar 

  11. Futamura, Y.: Partial evaluation of computation process-an approach to a compiler-compiler. Higher-Order Symb. Comput. 12(4), 381–391 (1999)

    Article  Google Scholar 

  12. 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)

    Google Scholar 

  13. Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. J. Log. Program. 11(3&4), 217–242 (1991)

    Article  MathSciNet  Google Scholar 

  14. Leuschel, M., Bruynooghe, M.: Logic program specialisation through partial deduction: control issues. TPLP 2(4–5), 461–515 (2002)

    MathSciNet  MATH  Google Scholar 

  15. Leuschel, M., Jørgensen, J., Vanhoof, W., Bruynooghe, M.: Offline specialisation in prolog using a hand-written compiler generator. CoRR cs.PL/0208009 (2002)

    Google Scholar 

  16. 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

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vincent Nys .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics