ebook img

The implementation of Prolog PDF

313 Pages·1993·13.586 MB·English, French
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview The implementation of Prolog

THE IMPLEMENTATION OF PROLOG PRINCETON SERIES IN COMPUTER SCIENCE David R. Hanson and Robert E. Tarjan, Editors The Implementation of the Icon Programming Language by Ralph E. Griswold and Madge T. Griswold (1986) Recent Advances in Global Optimization edited by Christodoulos A. Floudas and Panos M. Pardalos (1992) The Implementation of Prolog by Patrice Boizumault (1993) The present translated volume has been revised and updated since its original publication in French. All the programs developed in this book are available by anonymous ftp at ftp.cnam.fr in the directory pub/ Boizumault. We thank Mr. Bortzmeyer and Le Conservatoire des Arts et Metiers de Paris for their help. THE IMPLEMENTATION OF PROLOG PATRICE BOIZUMAULT Co-translated by Ara M. Djamboulian and Jamal Fattouh PRINCETON UNIVERSITY PRESS PRINCETON, NEW JERSEY Copyright © 1993 by Princeton University Press Published by Princeton University Press, 41 William Street, Princeton, New Jersey 08540 In the United Kingdom: Princeton University Press, Chichester, West Sussex This book was originally published in French as Prolog: L'Implantation, copyright © 1988 by Masson Editeur, Paris All Rights Reserved Library of Congress Cataloging-in-Publication Data Boizumault, Patrice, 1959- The implementation of Prolog I Patrice Boizumault. p. cm. — (Princeton series in computer science) Includes bibliographical references (p. ) and index. ISBN 0-691-08757-1 1. Prolog (Computer program language) I. Title. II. Series. QA76.73.p76B65 1993 005.13'3—dc20 92-25951 Princeton University Press books are printed on acid-free paper and meet the guidelines for permanence and durability of the Committee on Production Guidelines for Book Longevity of the Council on Library Resources Printed in the United States of America 10 9 8 7 6 5 4 3 21 To DOMINIQUE To ROGER AND ODETTE CONTENTS Foreword xi Acknowledgments xiii Introduction 3 PART I FUNDAMENTAL PRINCIPLES OF THE LANGUAGE CHAPTER1 UNIFICATION 1.1 Definitions 15 1.2 Robinson's Unification Algorithm 16 1.3 Prolog's Unification Algorithm 17 1.4 Solutions 19 1.5 Implementation 23 CHAPTER 2 RESOLUTION AND PROLOG CONTROL 2.1 Refutation on Horn Clauses 30 2.2 A Particular Resolution Strategy 33 2.3 Tree Representation 36 2.4 Implementation of a Pure Prolog Interpreter 43 CHAPTER 3 IMPROVING PROLOG CONTROL 3.1 Different Levels of Prolog Control 50 3.2 Variables Annotation in IC-Prolog 52 3.3 The Wait Declarations of MU-Prolog 54 3.4 The Predicatefreeze12 of Prolog-II 57 3.5 Comparison of Wait and Freeze 60 3.6 The When Declarations of NU-Prolog 65 via CONTENTS PART II PRINCIPLES AND TECHNIQUES OF IMPLEMENTATION CHAPTER 4 CONTROL AND STACK(S) MANAGEMENT 4.1 Prolog as a Programming Language 72 4.2 Stack Management 75 4.3 Restoring the Environments 79 CHAPTER 5 REPRESENTATION OF TERMS 5.1 Binding Mechanism 86 5.2 Structure Sharing 91 5.3 Structure Copying 93 CHAPTER 6 DETERMINISTIC CALL RETURNS 6.1 The Problem 103 6.2 Solution for Structure Sharing 105 6.3 Solution for Structure Copying 112 6.4 Comparisons 116 CHAPTER 7 LAST-CALL OPTIMIZATION 7.1 Last-Call Optimization 122 7.2 Implementation 125 CHAPTER 8 CLAUSE INDEXING 8.1 The Concept 137 8.2 Local Stack Enhancement 139 CHAPTER 9 COMPILATION OF PROLOG 9.1 Characteristics of the WAM 146 9.2 Compilation of a Clauses Set 150 9.3 Compilation of a Clause 154 9.4 Extensions 167 CONTENTS ix CHAPTER 10 THE DIF AND FREEZE PREDICATES OF PROLOG-II 10.1 The difll Predicate of Prolog-II 169 10.2 Implementation Principles 171 10.3 An Implementation of difll and freeze/2 178 10.4 Comparison with SICSTUS Prolog 184 PART III IMPLEMENTATIONS CHAPTER 11 MINI-CPROLOG 11.1 The Coding of Static Structures 191 11.2 The Working Zone Architecture 194 11.3 Unification 198 11.4 Control 200 11.5 Extensions 205 CHAPTER 12 MINI-WAM 12.1 Structure Copying 207 12.2 Working Zone Architecture 209 12.3 Unification 213 12.4 Control 216 12.5 Extensions 220 CHAPTER 13 MINI-PROLOG-II 13.1 The Working Zone Architecture 222 13.2 Unification 227 13.3 Control 228 13.4 The Delaying Mechanism 231 13.5 Extensions 236 CHAPTER 14 BUILT-IN PREDICATES 14.1 Management of the Built-in Predicates 237

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.