首页    期刊浏览 2024年11月30日 星期六
登录注册

文章基本信息

  • 标题:A Hitchhiker's Guide to Reinventing a Prolog Machine
  • 作者:Paul Tarau
  • 期刊名称:OASIcs : OpenAccess Series in Informatics
  • 电子版ISSN:2190-6807
  • 出版年度:2018
  • 卷号:58
  • 页码:10:1-10:16
  • DOI:10.4230/OASIcs.ICLP.2017.10
  • 出版社:Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik
  • 摘要: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.
  • 关键词:Prolog abstract machines; heap representation of terms and code; immutable goal stacks; natural language syntax for clauses; answer streams; multi-arg
Loading...
联系我们|关于我们|网站声明
国家哲学社会科学文献中心版权所有