Hostname: page-component-cd9895bd7-gvvz8 Total loading time: 0 Render date: 2024-12-17T19:12:34.305Z Has data issue: false hasContentIssue false

Tabling as a library with delimited control

Published online by Cambridge University Press:  03 September 2015

BENOIT DESOUTER
Affiliation:
Ghent University, Belgium (e-mail: [email protected], [email protected])
MARKO VAN DOOREN
Affiliation:
Ghent University, Belgium (e-mail: [email protected], [email protected])
TOM SCHRIJVERS
Affiliation:
KU Leuven, Belgium (e-mail: [email protected])
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Tabling is probably the most widely studied extension of Prolog. But despite its importance and practicality, tabling is not implemented by most Prolog systems. Existing approaches require substantial changes to the Prolog engine, which is an investment out of reach of most systems. To enable more widespread adoption, we present a new implementation of tabling in under 600 lines of Prolog code. Our lightweight approach relies on delimited control and provides reasonable performance.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2015 

References

Ceri, S., Gottlob, G. and Tanca, L. 1989. What you always wanted to know about Datalog (and never dared to ask). IEEE Trans. on Knowl. and Data Eng. 1, 1, 146166.Google Scholar
Chen, W. and Warren, D. S. 1996. Tabled evaluation with delaying for general logic programs. J. ACM 43, 1, 2074.Google Scholar
Danvy, O. and Filinski, A. 1990. Abstracting control. In Proceedings of the 1990 ACM conference on LISP and functional programming. LFP '90. ACM, 151–160.Google Scholar
de Guzmán, P. C., Carro, M., Hermenegildo, M. V., Silva, C. and Rocha, R. 2008. An improved continuation call-based implementation of tabling. In Practical Aspects of Declarative Languages, 10th International Symposium. Lecture Notes in Computer Science, vol. 4902. Springer, 197213.CrossRefGoogle Scholar
Demoen, B. and Sagonas, K. 1998a. Cat: The copying approach to tabling. In Principles of Declarative Programming, Palamidessi, C., Glaser, H., and Meinke, K., Eds. Lecture Notes in Computer Science, vol. 1490. Springer Berlin Heidelberg, 2135.Google Scholar
Demoen, B. and Sagonas, K. 1998b. Chat: The copy-hybrid approach to tabling. In Practical Aspects of Declarative Languages, Gupta, G., Ed. Lecture Notes in Computer Science, vol. 1551. Springer Berlin Heidelberg, 106121.Google Scholar
Fan, C. and Dietrich, S. W. 1992. Extension table built-ins for Prolog. Software: Practice and Experience 22, 7, 573597.Google Scholar
Felleisen, M. 1988. The theory and practice of first-class prompts. In Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. POPL '88. ACM, 180–190.Google Scholar
Guo, H. and Gupta, G. 2008. Simplifying dynamic programming via mode-directed tabling. Softw., Pract. Exper. 38, 1, 7594.Google Scholar
Guo, H.-F. and Gupta, G. 2001. A simple scheme for implementing tabled logic programming systems based on dynamic reordering of alternatives. In Proceedings of ICLP'01. Springer, 181–196.Google Scholar
Guo, H.-F. and Gupta, G. 2004. An efficient and flexible engine for computing fixed points. CoRR abs/cs/0412041.Google Scholar
Hermenegildo, M. V., Bueno, F., Carro, M., Lípez-García, P., Mera, E., Morales, J. F. and Puebla, G. 2012. An overview of Ciao and its design philosophy. Theory Pract. Log. Program. 12, 1–2 (Jan.), 219252.Google Scholar
Plotkin, G. D. and Pretnar, M. 2013. Handling algebraic effects. Logical Methods in Computer Science 9, 4.Google Scholar
Raimundo, J. and Rocha, R. 2011. Global trie for subterms. Online Proceedings of the 11th International Colloquium on Implementation of Constraint Logic Programming Systems (CICLOPS 2011).Google Scholar
Ramesh, R. and Chen, W. 1994. A portable method for integrating SLG resolution into Prolog systems. In Proceedings of the 1994 International Symposium on Logic Programming. ILPS '94. MIT Press, Cambridge, MA, USA, 618632.Google Scholar
Rocha, R., Silva, F. and Santos Costa, V. 2000. YapTab: A tabling engine designed to support parallelism. In Conference on Tabulation in Parsing and Deduction. 77–87.Google Scholar
Santos, J. and Rocha, R. 2013. On the efficient implementation of mode-directed tabling. In Practical Aspects of Declarative Languages - 15th International Symposium, PADL 2013. Lecture Notes in Computer Science, vol. 7752. Springer, 141156.Google Scholar
Santos Costa, V., Rocha, R. and Damas, L. 2012. The YAP Prolog system. TPLP 12, 1–2, 534.Google Scholar
Schrijvers, T., Demoen, B. and Desouter, B. 2013. Delimited continuations in Prolog: Semantics, use and implementation in the WAM. Report CW 631, Dept. of Computer Science, KU Leuven.Google Scholar
Schrijvers, T., Demoen, B., Desouter, B. and Wielemaker, J. 2013. Delimited continuations for Prolog. Theory and Practice of Logic Programming (TPLP). Proceedings of the International Conference on Logic Programming (ICLP).Google Scholar
Swift, T. and Warren, D. S. 2012. XSB: Extending Prolog with tabled logic programming. Theory Pract. Log. Program. 12, 1–2 (Jan.), 157187.Google Scholar
Tarau, P. 2012. The BinProlog experience: Architecture and implementation choices for continuation passing Prolog and first-class logic engines. TPLP 12, 1–2, 97126.Google Scholar
Tarau, P. and Dahl, V. 1994. Logic programming and logic grammars with first-order continuations. In LOPSTR '94. Vol. 883.Google Scholar
Zhou, N. 2012. The language features and architecture of B-Prolog. TPLP 12, 1–2, 189218.Google Scholar
Zhou, N.-F., Shen, Y.-D., Yuan, L.-Y. and You, J.-H. 2000. Implementation of a linear tabling mechanism. In Practical Aspects of Declarative Languages, Pontelli, E. and Santos Costa, V., Eds. Lecture Notes in Computer Science, vol. 1753. Springer Berlin Heidelberg, 109123.Google Scholar
Supplementary material: PDF

Desouter supplementary material

Online Appendix

Download Desouter supplementary material(PDF)
PDF 148.7 KB