A Hitchhiker's Guide to Reinventing a Prolog Machine

Author Paul Tarau



PDF
Thumbnail PDF

File

OASIcs.ICLP.2017.10.pdf
  • Filesize: 422 kB
  • 16 pages

Document Identifiers

Author Details

Paul Tarau

Cite As Get BibTex

Paul Tarau. A Hitchhiker's Guide to Reinventing a Prolog Machine. In Technical Communications of the 33rd International Conference on Logic Programming (ICLP 2017). Open Access Series in Informatics (OASIcs), Volume 58, pp. 10:1-10:16, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2018) https://doi.org/10.4230/OASIcs.ICLP.2017.10

Abstract

We take a fresh, "clean-room" look at implementing Prolog by deriving its translation to an executable representation
and its  execution algorithm from a simple Horn Clause meta-interpreter. 

The resulting design has some interesting properties.
The heap representation of terms and the abstract machine instruction encodings are the same.
No dedicated code area is used as the code is placed  directly on the heap.
Unification and indexing operations are orthogonal.
Filtering of matching clauses happens without building new structures on the heap.
Variables in function and predicate symbol positions are handled with no performance penalty.
A simple English-like syntax is used as an intermediate representation for clauses and goals and 
the same simple syntax can be used by programmers directly as an alternative to classic Prolog syntax.
Solutions of (multiple) logic engines are exposed as answer streams 
 that can be combined through typical functional programming patterns,
with flexibility to stop, resume, encapsulate and interleave executions.
Performance of a basic interpreter implementing our design is within a factor of 2 of a highly optimized compiled
WAM-based system using the same host language.

To help placing our design on the fairly rich map of Prolog systems, we discuss similarities 
to existing Prolog abstract machines, with emphasis on  separating  necessary
commonalities  from arbitrary implementation choices.

Subject Classification

Keywords
  • Prolog abstract machines
  • heap representation of terms and code
  • immutable goal stacks
  • natural language syntax for clauses
  • answer streams
  • multi-arg

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. H. Aït-Kaci. Warren’s Abstract Machine: A Tutorial Reconstruction. MIT Press, 1991. Google Scholar
  2. Burton H. Bloom. Space/Time Trade-offs in Hash Coding with Allowable Errors. Communications of the ACM, 13:422-426, 1970. Google Scholar
  3. Mats Carlson and Per Mildner. SICStus Prolog - The first 25 years. Theory and Practice of Logic Programming, 12:35-66, 1 2012. URL: http://dx.doi.org/10.1017/S1471068411000482.
  4. W. Chen, M. Kifer, and D.S. Warren. HiLog: A first-order semantics for higher-order logic programming constructs. In E.L. Lusk and R.A. Overbeek, editors, 1st North American Conf. Logic Programming, pages 1090-1114, Cleveland, OH, 1989. MIT Press. Google Scholar
  5. Vitor Santos Costa, Ricardo Rocha, and Luis Damas. The YAP Prolog system. Theory and Practice of Logic Programming, 12:5-34, 1 2012. URL: http://dx.doi.org/10.1017/S1471068411000512.
  6. M. V. Hermenegildo, F. Bueno, M. Carro, P. Lopez-Garcia, E. Mera, J. F. Morales, and G. Puebla. An overview of Ciao and its design philosophy. Theory and Practice of Logic Programming, 12:219-252, 1 2012. URL: http://dx.doi.org/10.1017/S1471068411000457.
  7. Torbjörn Lager and Jan Wielemaker. Pengines: Web logic programming made easy. TPLP, 14(4-5):539-552, 2014. URL: http://dx.doi.org/10.1017/S1471068414000192.
  8. Micha Meier. Compilation of compound terms in Prolog. In Saumya Debray and Manuel Hermenegildo, editors, Proceedings of the 1990 North American Conference on Logic Programming, pages 63-79, Cambridge, Massachusetts London, England, 1990. MIT Press. Google Scholar
  9. Oracle Corp. Java 8 Streams package. URL: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html.
  10. Alexandre Riazanov and Andrei Voronkov. Efficient Instance Retrieval with Standard and Relational Path Indexing, pages 380-396. Springer Berlin Heidelberg, Berlin, Heidelberg, 2003. URL: http://dx.doi.org/10.1007/978-3-540-45085-6_34.
  11. Terrance Swift and S. Warren, David. XSB: Extending Prolog with Tabled Logic Programming. Theory and Practice of Logic Programming, 12:157-187, 1 2012. URL: http://dx.doi.org/10.1017/S1471068411000500.
  12. Paul Tarau. Inference and Computation Mobility with Jinni. In K.R. Apt, V.W. Marek, and M. Truszczynski, editors, The Logic Programming Paradigm: a 25 Year Perspective, pages 33-48, Berlin Heidelberg, 1999. Springer. ISBN 3-540-65463-1. Google Scholar
  13. Paul Tarau. Fluents: A Refactoring of Prolog for Uniform Reflection and Interoperation with External Objects. In John Lloyd, editor, Computational Logic-CL 2000: First International Conference, London, UK, July 2000. LNCS 1861, Springer-Verlag. Google Scholar
  14. Paul Tarau. Jinni Prolog: a Java-based Prolog compiler and runtime system , May 2012. URL: https://code.google.com/archive/p/jinniprolog/.
  15. Paul Tarau. Kernel Prolog: a Java-based Prolog Interpreter Based on a Pure Object Oriented Term Hierarchy, May 2012. URL: https://code.google.com/archive/p/kernel-prolog/.
  16. Paul Tarau. Styla: a Lightweight Scala-based Prolog Interpreter Based on a Pure Object Oriented Term Hierarchy, May 2012. URL: https://code.google.com/archive/p/styla//.
  17. Paul Tarau. The BinProlog Experience: Architecture and Implementation Choices for Continuation Passing Prolog and First-Class Logic Engines. Theory and Practice of Logic Programming, 12(1-2):97-126, 2012. Google Scholar
  18. Paul Tarau and Michel Boyer. Elementary Logic Programs. In P. Deransart and J. Maluszyński, editors, Proceedings of Programming Language Implementation and Logic Programming, number 456 in Lecture Notes in Computer Science, pages 159-173, Berlin Heidelberg, August 1990. Springer. Google Scholar
  19. Peter Van Roy. 1983-1993: The Wonder Years of Sequential Prolog Implementation. Journal of Logic Programming, 19(20):385-441, 1994. Google Scholar
  20. David Vaz, Vítor Santos Costa, and Michel Ferreira. User defined indexing. In Proceedings of the 25th International Conference on Logic Programming, ICLP '09, pages 372-386, Berlin, Heidelberg, 2009. Springer-Verlag. URL: http://dx.doi.org/10.1007/978-3-642-02846-5_31.
  21. D. H. D. Warren. An Abstract Prolog Instruction Set. Technical Report 309, Artificial Intelligence Center, SRI International, 333 Ravenswood Ave, Menlo Park CA 94025, 1983. Google Scholar
  22. Jan Wielemaker, Tom Schrijvers, Markus Triska, and Torbjorn Lager. SWI-Prolog. Theory and Practice of Logic Programming, 12:67-96, 1 2012. URL: http://dx.doi.org/10.1017/S1471068411000494.
  23. Brett Wooldridge. Sparse Bit Set, 2016. https://github.com/brettwooldridge/SparseBitSet. Google Scholar
  24. Neng-Fa Zhou. The language features and architecture of B-Prolog. Theory and Practice of Logic Programming, 12:189-218, 1 2012. URL: http://dx.doi.org/10.1017/S1471068411000445.
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail