Hostname: page-component-78c5997874-dh8gc Total loading time: 0 Render date: 2024-11-13T04:58:56.992Z Has data issue: false hasContentIssue false

The language features and architecture of B-Prolog

Published online by Cambridge University Press:  12 September 2011

NENG-FA ZHOU*
Affiliation:
Department of Computer and Information Science, Brooklyn College and Graduate Center, The City University of New York, New York, USA (e-mail: zhou@sci.brooklyn.cuny.edu)

Abstract

B-Prolog is a high-performance implementation of the standard Prolog language with several extensions including matching clauses, action rules for event handling, finite-domain constraint solving, arrays and hash tables, declarative loop constructs, and tabling. The B-Prolog system is based on the Tree-Oriented Abstract Machine (TOAM) architecture which differs from the Warren Abstract Machine (WAM) mainly in that (1) arguments are passed old fashionedly through the stack, (2) only one frame is used for each predicate call, and (3) instructions are provided for encoding matching trees. The most recent architecture, called TOAM Jr., departs further from the WAM in that it employs no registers for arguments or temporary variables, and provides variable-size instructions for encoding predicate calls. This paper gives an overview of the language features and a detailed description of the TOAM Jr. architecture, including architectural support for action rules and tabling.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2011

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Carlsson, M. 1987. Freeze, indexing, and other implementation issues in the WAM. In Proceedings of the International Conference on Logic Programming (ICLP). MIT Press, Cambridge, USA, 4058.Google Scholar
Chen, W. and Warren, D. S. 1996. Tabled evaluation with delaying for general logic programs. Journal of the ACM 43B, 1, 2074.CrossRefGoogle Scholar
Debray, S. K. 1988. The SB-Prolog System, Version 3.0. SUNY Stony Brook.Google Scholar
Demoen, B. and Nguyen, P.-L. 2000. So many WAM variations, so little time. In Proceedings of the International Conference on Computational Logic (CL). LNAI, vol. 1861. 12401254.Google Scholar
Demoen, B. and Nguyen, P.-L. 2008a. Environment reuse in the WAM. In Proceedings of the International Conference on Logic Programming (ICLP). 698–702.CrossRefGoogle Scholar
Demoen, B. and Nguyen, P.-L. 2008b. Two WAM implementations of action rules. In Proceedings of the International Conference on Logic Programming (ICLP). 621–635.CrossRefGoogle Scholar
Dempster, A. P., Laird, N. M. and Rubin, D. B. 1977. Maximum likelihood from incomplete data via the EM algorithm. Proceedings of the Royal Statistical Society, vol. 39, no. 1, 1–38.Google Scholar
Forgy, C. L. 1982. Rete: A fast algorithm for the many pattern/many object pattern match problem. Artificial Intelligence 19, 1737.CrossRefGoogle Scholar
Guo, H.-F. and Gupta, G. 2008. Simplifying dynamic programming via mode-directed tabling. Software Practice and Experience 38, 1, 7594.CrossRefGoogle Scholar
Hickey, T. J. and Mudambi, S. 1989. Global compilation of Prolog. Journal of Logic Programming 7, 3, 193230.CrossRefGoogle Scholar
Kliger, S. and Shapiro, E. Y. 1990. From decision trees to decision graphs. In Proceedings of the North American Conference on Logic Programming (NACLP). 97–116.Google Scholar
Maier, D. and Warren, D. S. 1988. Computing with Logic: Logic Programming with Prolog. The Benjamin/Cummings Publishing Company, San Francisco, California, USA.Google Scholar
Meier, M. 1991. Recursion versus iteration in Prolog. In Proceedings of the International Conference on Logic Programming (ICLP). 157–169.Google Scholar
Meier, M. 1993. Better late than never. In ICLP-Workshop on Implementation of Logic Programming Systems. 151–165.CrossRefGoogle Scholar
Mohr, R. and Henderson, T. C. 1986. Arc and path consistency revisited. Artificial Intelligence 28, 225233.CrossRefGoogle Scholar
Morales, J. F., Carro, M., Puebla, G. and Hermenegildo, M. V. 2005. A generator of efficient abstract machine implementations and its application to emulator minimization. In Proceedings of the International Conference on Logic Programming (ICLP). 21–36.CrossRefGoogle Scholar
Moura, P. 2009. From plain Prolog to Logtalk objects: Effective code encapsulation and reuse. In Proceedings of the International Conference on Logic Programming (ICLP). 23.CrossRefGoogle Scholar
Nässén, H., Carlsson, M. and Sagonas, K. F. 2001. Instruction merging and specialization in the SICStus Prolog virtual machine. In Proceedings of the International Conference on Principles and Practice of Declarative Programming (PPDP). 49–60.CrossRefGoogle Scholar
Older, W. J. and Rummell, J. A. 1992. An incremental garbage collector for WAM-based Prolog. In Proceedings of the Joint International Conference and Symposium on Logic Programming (JICSLP). 369–383.Google Scholar
Ramakrishnan, I., Rao, P., Sagonas, K., Swift, T. and Warren, D. 1998. Efficient access mechanisms for tabled logic programs. Journal of Logic Programming 38, 3154.CrossRefGoogle Scholar
Sagonas, K. and Swift, T. 1998. An abstract machine for tabled execution of fixed-order stratified logic programs. ACM Transactions on Programming Languages and Systems 20, 3, 586634.CrossRefGoogle Scholar
Santos Costa, V. 1999. Optimizing bytecode emulation for Prolog. In Proceedings of the International Conference on Principles and Practice of Declarative Programming (PPDP). LNCS, vol. 1702. 261–277.Google Scholar
Santos Costa, V., Sagonas, K. F. and Lopes, R. 2007. Demand-driven indexing of Prolog clauses. In Proceedings of the International Conference on Logic Programming (ICLP). 395–409.CrossRefGoogle Scholar
Sato, T. 2009. Generative modeling by PRISM. In Proceedings of the International Conference on Logic Programming (ICLP). 24–35.CrossRefGoogle Scholar
Sato, T. and Kameya, Y. 2001. Parameter learning of logic programs for symbolic-statistical modeling. Journal of Artificial Intelligence Research 15, 391–454.Google Scholar
Schimpf, J. 2002. Logical loops. In Proceedings of the International Conference on Logic Programming (ICLP). 224–238.CrossRefGoogle Scholar
Schrijvers, T., Zhou, N.-F. and Demoen, B. 2006. Translating constraint handling rules into action rules. In Proceedings of the Third Workshop on Constraint Handling Rules. 141–155.Google Scholar
Tamaki, H. and Sato, T. 1986. OLD resolution with tabulation. In Proceedings of the International Conference on Logic Programming (ICLP). 84–98.CrossRefGoogle Scholar
Tarau, P. and Boyer, M. 1990. Elementary logic programs. In Proceedings of Programming Language Implementation and Logic Programming. 159–173.CrossRefGoogle Scholar
van Hentenryck, P. 1989. Constraint Satisfaction in Logic Programming. MIT Press.Google Scholar
Van Roy, P. 1990. Can logic programming execute as fast as imperative programming? PhD thesis UCB/CSD-90-600, EECS Department, University of California, Berkeley, CA.Google Scholar
Van Roy, P. 1994. 1983–1993: The wonder years of sequential Prolog implementation. Journal of Logic Programming 19, 20, 385441.CrossRefGoogle Scholar
Van Roy, P., Demoen, B. and Willems, Y. D. 1987. Improving the execution speed of compiled Prolog with modes, clause selection, and determinism. In TAPSOFT, vol. 2. 111–125.Google Scholar
Warren, D. H. D. 1977. Implementing Prolog-compiling predicate logic programs. Research report, 39–40, Department of Artificial Intelligence, University of Edinburgh, Edinburgh, Scotland, UK.Google Scholar
Warren, D. H. D. 1983. An abstract Prolog instruction set. Technical note 309, SRI International, Menlo Park, California.Google Scholar
Zhou, N.-F. 1994. On the scheme of passing arguments in stack frames for Prolog. In Proceedings of the International Conference on Logic Programming (ICLP). 159–174.Google Scholar
Zhou, N.-F. 1996a. Parameter passing and control stack management in Prolog implementation revisited. ACM Transactions on Programming Languages and Systems 18, 6, 752779.CrossRefGoogle Scholar
Zhou, N.-F. 1996b. A novel implementation method of delay. In Proceedings of the Joint International Conference and Symposium on Logic Programming (JICSLP). 97–111.Google Scholar
Zhou, N.-F. 1998. A high-level intermediate language and the algorithms for compiling finite-domain constraints. In Proceedings of the Joint International Conference and Symposium on Logic Programming (JICSLP). 70–84.Google Scholar
Zhou, N.-F. 2000. Garbage collection in B-Prolog. In First Workshop on Memory Management in Logic Programming Implementations. 16–25.Google Scholar
Zhou, N.-F. 2003. CGLIB—a constraint-based graphics library. Software Practice and Experience 33, 13, 11991216.CrossRefGoogle Scholar
Zhou, N.-F. 2006. Programming finite-domain constraint propagators in action rules. Theory and Practice of Logic Programming (TPLP) 6, 5, 483508.CrossRefGoogle Scholar
Zhou, N.-F. 2007. A register-free abstract Prolog machine with jumbo instructions. In Proceedings of the International Conference on Logic Programming (ICLP). 455–457.CrossRefGoogle Scholar
Zhou, N.-F. 2009. Encoding table constraints in CLP(FD) based on pair-wise AC. In Proceedings of the International Conference on Logic Programming (ICLP). 402–416.CrossRefGoogle Scholar
Zhou, N.-F., Kameya, Y., and Sato, T. 2010. Mode-directed tabling for dynamic programming, machine learning, and constraint solving. In Proceedings of the International Conference on Tools with Artificial Intelligence (ICTAI). 213–218.Google Scholar
Zhou, N.-F., Sato, T. and Shen, Y.-D. 2008. Linear tabling strategies and optimizations. Theory and Practice of Logic Programming (TPLP) 8, 1, 81109.CrossRefGoogle Scholar
Zhou, N.-F., Shen, Y.-D. and You, J. 2011. Compiling answer set programs into event-driven action rules. In Proceedings of the International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR). 376–381.CrossRefGoogle Scholar
Zhou, N.-F., Shen, Y.-D., Yuan, L. and You, J. 2001. Implementation of a linear tabling mechanism. Journal of Functional and Logic Programming 1, 115.Google Scholar
Zhou, N.-F., Takagi, T. and Ushijima, K. 1990. A matching tree oriented abstract machine for Prolog. In Proceedings of the International Conference on Logic Programming (ICLP). 159–173.Google Scholar
Zhou, N.-F., Wallace, M. and Stuckey, P. J. 2006. The dom event and its use in implementing constraint propagators. Technical report TR-2006013, CUNY Computer Science, The City University of New York, New York.Google Scholar