15,876 research outputs found
On the Implementation of GNU Prolog
GNU Prolog is a general-purpose implementation of the Prolog language, which
distinguishes itself from most other systems by being, above all else, a
native-code compiler which produces standalone executables which don't rely on
any byte-code emulator or meta-interpreter. Other aspects which stand out
include the explicit organization of the Prolog system as a multipass compiler,
where intermediate representations are materialized, in Unix compiler
tradition. GNU Prolog also includes an extensible and high-performance finite
domain constraint solver, integrated with the Prolog language but implemented
using independent lower-level mechanisms. This article discusses the main
issues involved in designing and implementing GNU Prolog: requirements, system
organization, performance and portability issues as well as its position with
respect to other Prolog system implementations and the ISO standardization
initiative.Comment: 30 pages, 3 figures, To appear in Theory and Practice of Logic
Programming (TPLP); Keywords: Prolog, logic programming system, GNU, ISO,
WAM, native code compilation, Finite Domain constraint
Tabling as a Library with Delimited Control
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.Comment: 15 pages. To appear in Theory and Practice of Logic Programming
(TPLP), Proceedings of ICLP 201
Pengines: Web Logic Programming Made Easy
When developing a (web) interface for a deductive database, functionality
required by the client is provided by means of HTTP handlers that wrap the
logical data access predicates. These handlers are responsible for converting
between client and server data representations and typically include options
for paginating results. Designing the web accessible API is difficult because
it is hard to predict the exact requirements of clients. Pengines changes this
picture. The client provides a Prolog program that selects the required data by
accessing the logical API of the server. The pengine infrastructure provides
general mechanisms for converting Prolog data and handling Prolog
non-determinism. The Pengines library is small (2000 lines Prolog, 150 lines
JavaScript). It greatly simplifies defining an AJAX based client for a Prolog
program and provides non-deterministic RPC between Prolog processes as well as
interaction with Prolog engines similar to Paul Tarau's engines. Pengines are
available as a standard package for SWI-Prolog 7.Comment: To appear in Theory and Practice of Logic Programmin
Enhancing a Search Algorithm to Perform Intelligent Backtracking
This paper illustrates how a Prolog program, using chronological backtracking
to find a solution in some search space, can be enhanced to perform intelligent
backtracking. The enhancement crucially relies on the impurity of Prolog that
allows a program to store information when a dead end is reached. To illustrate
the technique, a simple search program is enhanced.
To appear in Theory and Practice of Logic Programming.
Keywords: intelligent backtracking, dependency-directed backtracking,
backjumping, conflict-directed backjumping, nogood sets, look-back.Comment: To appear in Theory and Practice of Logic Programmin
Improving Prolog programs: Refactoring for Prolog
Refactoring is an established technique from the object-oriented (OO)
programming community to restructure code: it aims at improving software
readability, maintainability and extensibility. Although refactoring is not
tied to the OO-paradigm in particular, its ideas have not been applied to Logic
Programming until now.
This paper applies the ideas of refactoring to Prolog programs. A catalogue
is presented listing refactorings classified according to scope. Some of the
refactorings have been adapted from the OO-paradigm, while others have been
specifically designed for Prolog. The discrepancy between intended and
operational semantics in Prolog is also addressed by some of the refactorings.
In addition, ViPReSS, a semi-automatic refactoring browser, is discussed and
the experience with applying ViPReSS to a large Prolog legacy system is
reported. The main conclusion is that refactoring is both a viable technique in
Prolog and a rather desirable one.Comment: To appear in Theory and Practice of Logic Programming (TPLP
SWI-Prolog and the Web
Where Prolog is commonly seen as a component in a Web application that is
either embedded or communicates using a proprietary protocol, we propose an
architecture where Prolog communicates to other components in a Web application
using the standard HTTP protocol. By avoiding embedding in external Web servers
development and deployment become much easier. To support this architecture, in
addition to the transfer protocol, we must also support parsing, representing
and generating the key Web document types such as HTML, XML and RDF.
This paper motivates the design decisions in the libraries and extensions to
Prolog for handling Web documents and protocols. The design has been guided by
the requirement to handle large documents efficiently. The described libraries
support a wide range of Web applications ranging from HTML and XML documents to
Semantic Web RDF processing.
To appear in Theory and Practice of Logic Programming (TPLP)Comment: 31 pages, 24 figures and 2 tables. To appear in Theory and Practice
of Logic Programming (TPLP
Customisable Handling of Java References in Prolog Programs
Integration techniques for combining programs written in distinct language
paradigms facilitate the implementation of specialised modules in the best
language for their task. In the case of Java-Prolog integration, a known
problem is the proper representation of references to Java objects on the
Prolog side. To solve it adequately, multiple dimensions should be considered,
including reference representation, opacity of the representation, identity
preservation, reference life span, and scope of the inter-language conversion
policies. This paper presents an approach that addresses all these dimensions,
generalising and building on existing representation patterns of foreign
references in Prolog, and taking inspiration from similar inter-language
representation techniques found in other domains. Our approach maximises
portability by making few assumptions about the Prolog engine interacting with
Java (e.g., embedded or executed as an external process). We validate our work
by extending JPC, an open-source integration library, with features supporting
our approach. Our JPC library is currently compatible with three different open
source Prolog engines (SWI, YAP} and XSB) by means of drivers. To appear in
Theory and Practice of Logic Programming (TPLP).Comment: 10 pages, 2 figure
- …