没有合适的资源?快使用搜索试试~ 我知道了~
xsb prolog实现wam扩展的prolog系统,可帮助程序员关注问题的逻辑模拟。
资源推荐
资源详情
资源评论
The XSB System
Version 3.5.x
Volume 1: Programmer’s Manual
xsb
Terrance Swift David S. Warren
Konstantinos Sagonas
Juliana Freire
Prasad Rao
Baoqiu Cui
Ernie Johnson
Luis de Castro
Rui F. Marques
Diptikalyan Saha
Steve Dawson
Michael Kifer
June 29, 2014
Credits
Day-to-day care and feeding of XSB including bug fixes, ports, and configuration
management is currently done by David Warren and Terrance Swift with the
help of Michael Kifer and others. In the past Kostis Sagonas, Prasad Rao, Steve
Dawson, J uliana Freire, Ern ie Johns on , Baoqiu Cui, Bart Demoen and Luis F.
Castro have pr ovided tremendous help.
In Version 3.5, the core engine development of the SLG-WAM has been mainly
implemented by Terrance Swift, David Warren, Kostis Sagonas, Prasad Rao,
Juliana Freire, Ernie Johnson, Luis Castro and Rui Marques. The br eakdown,
very roughly, was th at Terrance Swift wrote the initial tabling engine, th e SLG-
WAM, and its built-ins; and leads the current development of the tabling sub-
system. Prasad Rao reimplemented the engine’s tabling su bsystem to use tries
for variant-based table access and Ernie Johnson extended and refactored these
routines in a number of ways, including adding call subsumption. Kostis Sag-
onas implemented most of tabled negation. Juliana Freire revised the table
scheduling mechanism starting from Version 1.5.0 to create the batched and
local scheduling that is currently used. Baoqiu Cui revised the data struc-
tures used to maintain delay lists, and added attributed variables to the engine.
Luis Castro rewrote the emulator to use jump tables and wrote a heap-garbage
collector for the SLG-WAM. Rui Marques was responsible for the concurrency
control algorithms used for shared tables, and mainly responsible for making th e
XSB engine multi-thr eaded. The incremental table maintenance subsystem was
designed and first implemented by Diptikalyan Saha, and its design and devel-
opment has been continued by Terrance Swift. Answer subsumption was written
by David Warren and Terrance Swift. David Warren implemented hash-consed,
or “interned” tables. Call abstraction and answer abstraction (restraint) were
written by Terrance Swift.
Other engine work includes the following. Memory expansion code f or WAM
stacks was wr itten by Ernie Johnson, Bart Demoen and David S. Warr en . Heap
garbage collection was written by Luis d e Castro, Kostis Sagonas and Bart
Demoen. Atom sp ace garbage collection was written by David Warren; table
garbage collection was written by Terrance Swift based in part on space recla-
mation code written by Prasad Rao. Rui Marques rewrote much of the engine to
make it compliant with 64-bit architectures. Assert and retract code was based
on code written by Jiyang Xu; it significantly revised by David S. Warren, who
added alternative, multiple, and star indexing and by Terrance Swift who im-
plemented dynamic clause garbage collection. Trie assert/retract code, and trie
interning code was written by Prasad Rao, as was most code for reclaiming ta-
ble space. Neng-fa Zhou , Terrance Sw ift and David Warren upgraded XSB from
ASCII to the character sets UTF-8, C1253, and LATIN-1. The current ver-
sion of findall/3 was re-written from s cratch by Bart Demoen, as was XSB’s
2
original throw and catch mechanism. 64-bit floats were added by Charles Rojo.
In terms of core system Prolog code, Kostis Sagonas was responsible f or HiLog
compilation and associated built-ins as well as coding or revising many standard
predicates. Steve Dawson implemented Unification Factoring. The revision of
XSB’s I/O into ISO-compatible streams was done by Michael Kifer and Terrance
Swift. The auto_table and suppl _table directives were written by Kostis
Sagonas. The DCG expansion module was written by Kostis Sagonas for non-
tabled code and by Baoqiu Cui, David Warren and Terrance Swift for tabled
co de. The handling of the multi file directive was wr itten by Baoqiu C ui and
David Warren. C.R. Ramakrishnan wrote the mode analyzer for XSB. Michael
Kifer implemented the storage module. The multi-threaded API was written
by Terrance Swift and Rui Marques. Walter Wilson has wr itten several of XSB’s
library predicates for tabling. Paulo Moura has added several predicates to make
XSB more consistent with other Prologs.
Michael Kifer has been in charge of XS B’s ins tallation procedur es, rewriting
parts of the XSB code to make XSB configurable with GNU’s Autoconf, im-
plementing XSB’s package system, and integrated GPP with XSB’s compiler.
GPP, the source code preprocessor used by XSB, was written by Denis Auroux,
who also wrote the GPP manual reproduced in Appendix A.
The starting point of XSB (in 1990) was PSB-Prolog 2.0 by Jiyang Xu and David
Warren. PSB-Prolog in its turn was based on SB-Prolog, primarily designed and
written by Saumya Debray, David S . Warren, and Jiyang Xu. Thanks are also
due to Weidong Chen for his work on Prolog clause indexing for SB-Prolog, to
Richard O’Keefe, who contributed the Prolog code for the Prolog r eader and
the C code for the tokenizer, to Ciao Prolog w hose write_term/[2,3] we u se,
and to SWI Prolog for their CLP(R) package.
... Now what did I forget this time ?
Contents
1 Introduction 1
1.1 Using This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Getting St arted with XSB 7
2.1 Installing XSB under UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Possible Installation Problems . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Installing XSB under Windows . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1 Using Cygnus Software’s CygWin32 . . . . . . . . . . . . . . . . . . 12
2.2.2 Using Microsoft Visual C++ . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Invoking XSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 Compiling XSB p rograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Sample XSB Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.6 Exiting XSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 System Description 18
3.1 Entering and Exiting XSB from the Command Lin e . . . . . . . . . . . . . 18
3.2 The System and its Directories . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 How XSB Finds Files: Source File Designators . . . . . . . . . . . . . . . . 20
3.4 The Module System of XSB . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.5 Standard Predicates in XSB . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.6 The Dynamic Loader and its Search Path . . . . . . . . . . . . . . . . . . . 28
3.6.1 Changing the Default Search Path and the Packaging System . . . . 28
3.6.2 Dynamically loading predicates in the interpreter . . . . . . . . . . . 31
i
CONTENTS ii
3.7 Command Line Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.8 Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.9 Compiling, Consulting, and Loading . . . . . . . . . . . . . . . . . . . . . . 37
3.9.1 Static Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.9.2 Dynamic Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.9.3 The multifile directive . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.10 The Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.10.1 Invoking the C ompiler . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.10.2 Compiler Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.10.3 Specialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.10.4 Compiler Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.10.5 Conditional Compilation . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.10.6 Inline Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.11 A Note on ISO Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4 Syntax 61
4.1 Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.1.1 Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.1.2 Floating-point Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.1.3 Atoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.1.4 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.1.5 Compound Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.1.6 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.2 From HiLog to Prolog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.3 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5 Using Tabling in XSB: A Tutorial Introduction 73
5.1 Tabling in the Context of a Prolog System . . . . . . . . . . . . . . . . . . . 73
5.2 Definite Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.2.1 Call Variance vs. Call Sub sumption . . . . . . . . . . . . . . . . . . 78
5.2.2 Tabling with Interned Term s . . . . . . . . . . . . . . . . . . . . . . 80
剩余470页未读,继续阅读
资源评论
fodeluo
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功