Hostname: page-component-76c49bb84f-229nc Total loading time: 0 Render date: 2025-07-08T09:42:58.741Z Has data issue: false hasContentIssue false

Offline specialisation in Prolog using a hand-writtencompiler generator

Published online by Cambridge University Press:  06 January 2004

MICHAEL LEUSCHEL
Affiliation:
DSSE, Department of Computer Science, University of Southampton, Highfield SO17 1BJ, UK
JESPER JØRGENSEN
Affiliation:
Department of Mathematics and Physics, Royal Veterinary and Agricultural University, Thorvaldsensvej 40, DK-1871 Frederiksberg C, Denmark
WIM VANHOOF
Affiliation:
Department of Computer Science, Katholieke Universiteit Leuven, Celestijnenlaan 200A, B-3001 Heverlee, Belgium
MAURICE BRUYNOOGHE
Affiliation:
Department of Computer Science, Katholieke Universiteit Leuven, Celestijnenlaan 200A, B-3001 Heverlee, Belgium

Abstract

The so called “cogen approach” to programspecialisation, writing a compiler generator instead of aspecialiser, has been used with considerable success in partialevaluation of both functional and imperative languages. This paperdemonstrates that the cogen approach is alsoapplicable to the specialisation of logic programs (called partialdeduction) and leads to effective specialisers. Moreover, using goodbinding-time annotations, the speed-ups of the specialised programsare comparable to the speed-ups obtained with online specialisers.The paper first develops a generic approach to offline partialdeduction 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, it is used to developthe cogen system LOGEN. Given a program, aspecification of what inputs will be static, and an annotationspecifying which calls should be unfolded, LOGEN generatesa specialised specialiser for the program at hand. Running thisspecialiser with particular values for the static inputs results inthe specialised program. While this requires two steps instead ofone, the efficiency of the specialisation process is improved insituations where the same program is specialised multiple times. Thepaper also presents and evaluates an automatic binding-time analysisthat is able to derive the annotations. While the derivedannotations are still suboptimal compared to hand-crafted ones, theyenable non-expert users to use the LOGEN system in a fullyautomated way. Finally, LOGEN is extended so as to directlysupport a large part of Prolog's declarative and non-declarativefeatures and so as to be able to perform so called mixlinespecialisations.

Information

Type
Regular Papers
Copyright
© 2004 Cambridge University Press

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Article purchase

Temporarily unavailable