The University of Southampton
University of Southampton Institutional Repository

Offline Specialisation in Prolog Using a Hand-Written Compiler Generator

Offline Specialisation in Prolog Using a Hand-Written Compiler Generator
Offline Specialisation in Prolog Using a Hand-Written Compiler Generator
The so called "cogen approach" to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success in partial evaluation of both functional and imperative languages. This paper demonstrates that the "cogen" approach is also applicable to the specialisation of logic programs (called partial deduction when applied to pure logic programs) and leads to effective specialisers. Moreover, using good binding-time annotations, the speed-ups of the specialised programs are comparable to the speed-ups obtained with online specialisers. The paper first develops a generic approach to offline partial deduction and then a specific offline partial deduction method, leading to the offline system LIX for pure logic programs. While this is a usable specialiser by itself, its specialisation strategy is used to develop the "cogen" system LOGEN. Given a program, a specification of what inputs will be static, and an annotation specifying which calls should be unfolded, LOGEN generates a specialised specialiser for the program at hand. Running this specialiser with particular values for the static inputs results in the specialised program. While this requires two steps instead of one, the efficiency of the specialisation process is improved in situations where the same program is specialised multiple times. The paper also presents and evaluates an automatic binding-time analysis that is able to derive the annotations. While the derived annotations are still suboptimal compared to hand-crafted ones, they enable non-expert users to use the LOGEN system in a fully automated way Finally, LOGEN is extended so as to directly support a large part of Prolog's declarative and non-declarative features and so as to be able to perform so called mixline specialisations. In mixline specialisation some unfolding decisions depend on the outcome of tests performed at specialisation time instead of being hardwired into the specialiser.
139-191
Leuschel, Michael
c2c18572-66cf-4f84-ade4-218ce3afe78b
Jørgensen, Jesper
42168a17-be3e-4577-a109-1b58754845e5
Vanhoof, Wim
b5c3bd66-143d-4301-95fa-afdc35e03539
Bruynooghe, Maurice
d330a4d8-e9d8-4994-8672-0a89fe4df305
Leuschel, Michael
c2c18572-66cf-4f84-ade4-218ce3afe78b
Jørgensen, Jesper
42168a17-be3e-4577-a109-1b58754845e5
Vanhoof, Wim
b5c3bd66-143d-4301-95fa-afdc35e03539
Bruynooghe, Maurice
d330a4d8-e9d8-4994-8672-0a89fe4df305

Leuschel, Michael, Jørgensen, Jesper, Vanhoof, Wim and Bruynooghe, Maurice (2004) Offline Specialisation in Prolog Using a Hand-Written Compiler Generator. Theory and Practice of Logic Programming, 4 (1), 139-191.

Record type: Article

Abstract

The so called "cogen approach" to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success in partial evaluation of both functional and imperative languages. This paper demonstrates that the "cogen" approach is also applicable to the specialisation of logic programs (called partial deduction when applied to pure logic programs) and leads to effective specialisers. Moreover, using good binding-time annotations, the speed-ups of the specialised programs are comparable to the speed-ups obtained with online specialisers. The paper first develops a generic approach to offline partial deduction and then a specific offline partial deduction method, leading to the offline system LIX for pure logic programs. While this is a usable specialiser by itself, its specialisation strategy is used to develop the "cogen" system LOGEN. Given a program, a specification of what inputs will be static, and an annotation specifying which calls should be unfolded, LOGEN generates a specialised specialiser for the program at hand. Running this specialiser with particular values for the static inputs results in the specialised program. While this requires two steps instead of one, the efficiency of the specialisation process is improved in situations where the same program is specialised multiple times. The paper also presents and evaluates an automatic binding-time analysis that is able to derive the annotations. While the derived annotations are still suboptimal compared to hand-crafted ones, they enable non-expert users to use the LOGEN system in a fully automated way Finally, LOGEN is extended so as to directly support a large part of Prolog's declarative and non-declarative features and so as to be able to perform so called mixline specialisations. In mixline specialisation some unfolding decisions depend on the outcome of tests performed at specialisation time instead of being hardwired into the specialiser.

Text
cogen-journal.tplpfinal.pdf - Other
Download (493kB)

More information

Published date: 2004
Organisations: Electronics & Computer Science

Identifiers

Local EPrints ID: 256605
URI: http://eprints.soton.ac.uk/id/eprint/256605
PURE UUID: b0e63005-ed62-4052-b37b-670c796f7020

Catalogue record

Date deposited: 06 Jun 2002
Last modified: 09 Dec 2019 20:18

Export record

Contributors

Author: Michael Leuschel
Author: Jesper Jørgensen
Author: Wim Vanhoof
Author: Maurice Bruynooghe

University divisions

Download statistics

Downloads from ePrints over the past year. Other digital versions may also be available to download e.g. from the publisher's website.

View more statistics

Atom RSS 1.0 RSS 2.0

Contact ePrints Soton: eprints@soton.ac.uk

ePrints Soton supports OAI 2.0 with a base URL of http://eprints.soton.ac.uk/cgi/oai2

This repository has been built using EPrints software, developed at the University of Southampton, but available to everyone to use.

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we will assume that you are happy to receive cookies on the University of Southampton website.

×