lp2cpp: A Tool For Compiling Stratified Logic Programs

  • Bernardo CuteriEmail author
  • Alessandro Francesco De Rosis
  • Francesco Ricca
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10640)


The evaluation of logic programs is traditionally implemented in monolithic systems that are general-purpose in the sense that they are able to process an entire class of programs. In this paper, we follow a different approach; we present a compilation procedure that is able to generate a problem-specific executable implementation of a given (non-ground) logic program. Our implementation follows a bottom-up evaluation strategy. Moreover, we implemented such procedure into a C++ tool and we present an experimental analysis that shows the performance benefits that can be obtained by a compilation-based approach.


Compilation Logic programming Stratified programs Deductive databases 


  1. 1.
    Arni, F., Ong, K., Tsur, S., Wang, H., Zaniolo, C.: The deductive database system LDL++. TPLP 3(1), 61–94 (2003)zbMATHGoogle Scholar
  2. 2.
    Brewka, G., Eiter, T., Truszczynski, M.: Answer set programming at a glance. Commun. ACM 54(12), 92–103 (2011)CrossRefGoogle Scholar
  3. 3.
    Calì, A., Gottlob, G., Lukasiewicz, T., Pieris, A.: Datalog+/-: a family of languages for ontology querying. In: de Moor, O., Gottlob, G., Furche, T., Sellers, A. (eds.) Datalog 2.0 2010. LNCS, vol. 6702, pp. 351–368. Springer, Heidelberg (2011). CrossRefGoogle Scholar
  4. 4.
    Calimeri, F., Fuscà, D., Perri, S., Zangari, J.: \(\cal{I}\)-dlv: the new intelligent grounder of dlv. In: Adorni, G., Cagnoni, S., Gori, M., Maratea, M. (eds.) AI*IA 2016. LNCS, vol. 10037, pp. 192–207. Springer, Cham (2016). CrossRefGoogle Scholar
  5. 5.
    Ceri, S., Gottlob, G., Tanca, L.: Logic Programming and Databases. Springer, Heidelberg (1990). CrossRefGoogle Scholar
  6. 6.
    Cuteri, B., Ricca, F.: A compiler for stratified datalog programs: preliminary results. In: 25th Italian Symposium on Advanced Database Systems, SEBD 2017, Squillace, Catanzaro, Italy, 25–29 June 2017. (2017, to appear)Google Scholar
  7. 7.
    Erdem, E., Gelfond, M., Leone, N.: Applications of answer set programming. AI Mag. 37(3), 53–68 (2016)CrossRefGoogle Scholar
  8. 8.
    Gebser, M., Kaminski, R., Kaufmann, B., Ostrowski, M., Schaub, T., Wanko, P.: Theory solving made easy with clingo 5. In: ICLP 2016 TCs. pp. 2:1–2:15 (2016)Google Scholar
  9. 9.
    Huang, S.S., Green, T.J., Loo, B.T.: Datalog and emerging applications: an interactive tutorial. In: Proceedings of SIGMOD 2011, pp. 1213–1216. ACM (2011)Google Scholar
  10. 10.
    Kaufmann, B., Leone, N., Perri, S., Schaub, T.: Grounding and solving in answer set programming. AI Mag. 37(3), 25–32 (2016)CrossRefGoogle Scholar
  11. 11.
    Kifer, M., Lozinskii, E.L.: On compile-time query optimization in deductive databases by means of static filtering. ACM TDS 15(3), 385–426 (1990)CrossRefMathSciNetGoogle Scholar
  12. 12.
    Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM TOCL 7(3), 499–562 (2006)CrossRefzbMATHMathSciNetGoogle Scholar
  13. 13.
    Liang, S., Fodor, P., Wan, H., Kifer, M.: Openrulebench: an analysis of the performance of rule engines. In: Proceedings of WWW 2009, pp. 601–610. ACM (2009)Google Scholar
  14. 14.
    Liu, Y.A., Stoller, S.D.: From datalog rules to efficient programs with time and space guarantees. ACM Trans. Program. Lang. Syst. 31(6), 21:1–21:38 (2009)CrossRefGoogle Scholar
  15. 15.
    Scholz, B., Jordan, H., Subotić, P., Westmann, T.: On fast large-scale program analysis in datalog. In: Proceedings of the 25th International Conference on Compiler Construction, pp. 196–206. ACM (2016)Google Scholar
  16. 16.
    Scholz, B., Vorobyov, K., Krishnan, P., Westmann, T.: A datalog source-to-source translator for static program analysis: an experience report. In: 2015 24th Australasian Software Engineering Conference (ASWEC), pp. 28–37. IEEE (2015)Google Scholar
  17. 17.
    Sereni, D., Avgustinov, P., de Moor, O.: Adding magic to an optimising datalog compiler. In: Proceedings of the 2008 ACM SIGMOD International Conference on Management of Data, pp. 553–566. ACM (2008)Google Scholar
  18. 18.
    Terracina, G., Leone, N., Lio, V., Panetta, C.: Experimenting with recursive queries in database and logic programming systems. Theory Pract. Logic Program. 8(2), 129–165 (2008)CrossRefzbMATHMathSciNetGoogle Scholar
  19. 19.
    Ullman, J.D.: Principles of Database and Knowledge-Base Systems. Computer Science Press, New York (1988)Google Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  • Bernardo Cuteri
    • 1
    Email author
  • Alessandro Francesco De Rosis
    • 1
  • Francesco Ricca
    • 1
  1. 1.DeMaCSUniversità della CalabriaRendeItaly

Personalised recommendations