1% BEGIN LICENSE BLOCK 2% Version: CMPL 1.1 3% 4% The contents of this file are subject to the Cisco-style Mozilla Public 5% License Version 1.1 (the "License"); you may not use this file except 6% in compliance with the License. You may obtain a copy of the License 7% at www.eclipse-clp.org/license. 8% 9% Software distributed under the License is distributed on an "AS IS" 10% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11% the License for the specific language governing rights and limitations 12% under the License. 13% 14% The Original Code is The ECLiPSe Constraint Logic Programming System. 15% The Initial Developer of the Original Code is Cisco Systems, Inc. 16% Portions created by the Initial Developer are 17% Copyright (C) 1995 - 2006 Cisco Systems, Inc. All Rights Reserved. 18% 19% Contributor(s): 20% 21% END LICENSE BLOCK 22% 23% @(#)umsintro.tex 1.11 95/03/17 24% $Id: umsintro.tex,v 1.6 2015/01/14 01:31:10 jschimpf Exp $ 25% 26% REL DATE AUTHOR DESCRIPTION 27% 2.10 090589 David Miller Convert to Latex and update for 2.10 28% 120489 Micha Meier Rewritten, added list of {\eclipse} features 29% 160590 Joachim Schimpf Updated for 3.0 30% 160590 Joachim Schimpf Updated for 3.2 31% see SCCS comments 32 33\chapter{Introduction} 34\label{chapintro} 35%HEVEA\cutdef[1]{section} 36 37\section{What is {\eclipse} ?} 38{\eclipse}{} ({\eclipse} Constraint Logic Programming System) 39is an open-source software system whose aim is to serve as a platform 40for integrating various Logic Programming extensions. 41It is used in particular for the cost-effective 42development and deployment of constraint programming applications, 43e.g. in the areas of planning, scheduling, resource allocation, 44timetabling, transport etc. It is also ideal for teaching most 45aspects of combinatorial problem solving, e.g. problem modelling, 46constraint programming, mathematical programming, and search 47techniques. It contains several constraint solver libraries, a 48high-level modelling and control language, interfaces to third-party 49solvers, an integrated development environment and interfaces for 50embedding into host environments. 51 52The {\eclipse} programming language has been developed from the Prolog 53language (\cite{clocksin81}), more specifically the Edinburgh family 54of Prologs and more recently the ISO Prolog standard (\cite{isoprolog95}). 55{\eclipse} retains backward compatibility by supporting several language 56dialects. 57 58In terms of implementation technology, {\eclipse} is built around an 59incremental compiler which compiles {\eclipse} source into WAM-like 60code \cite{warren83}, and a runtime system comprising an emulator of 61this abstract code, automatic memory management, I/O system and 62built-in predicates. 63 64 65 66\section{Overview} 67\index{ECLiPSe@\eclipse} 68\index{SEPIA@\sepia} 69\index{MegaLog} 70\index{CHIP} 71The {\eclipse} logic programming system was originally an integration of 72ECRC's \sepia, MegaLog and (parts of the) CHIP systems. 73It was then further developed into a Constraint Logic Programming system 74with a focus on hybrid problem solving and solver integration. 75The documentation is organised as follows: 76\begin{description} 77\item [The User Manual] describes the functionality 78of the {\eclipse} kernel (this document). 79\item [The Constraint Library Manual] describes the major {\eclipse} libraries, 80in particular the ones implementing constraint solvers. 81\item [The Interfacing and Embedding Manual] describes how to interface 82{\eclipse} to other programming languages, and in particular how to embed 83it into an application as a component. 84\item [The Reference Manual] contains detailed descriptions of all the 85Built-in predicates and the libraries. This information is also available 86from the development system's help/1 command and the tkeclipse library 87browser. 88\item [The Visualisation Manual] describes the facilities for the 89visualisation of constraint propagation and search. 90\end{description} 91All the documentation can be accessed using an html browser 92(refer to the eclipse installation directory under doc/index.html). 93 94%\section{{\eclipse} Features} 95%The following sections outline some remarkable features of {\eclipse}: 96% 97%\subsection{Metaterms} 98%{\eclipse} provides the user with the {\bf metaterm} data type which is the key 99%\index{metaterm} 100%to many extensions to the basic Prolog language. 101%It can be seen as a generic data type or as an attributed variable. 102%The system calls user-definable event handlers 103%when it encounters metaterms in certain contexts, e.g., unification. 104% 105%\subsection{Incremental Compiler} 106%{\eclipse} is based on an {\it incremental interactive compiler}, 107%it contains no interpreter, all procedures are compiled. 108%The compilation is transparent to the user, no loading or linking 109%has to be done. 110%{\eclipse} programs are both fast (like compiled programs) and flexible (like 111%interpreted ones). 112%The compiler can compile faster than most other Prologs consult their sources. 113% 114%\subsection{Source Variable Names} 115%\index{variable names} 116%{\eclipse} is able to remember the source names 117%of variables so that e.g., debugging programs becomes much easier. 118%By default, the toplevel loop and the debugger print variables with 119%their source names. 120%The compiler by default checks if the compiled clauses contain 121%singleton variables and emits a warning if it is the case. 122% 123%\subsection{Flexibility} 124%{\eclipse} enables the user to modify most of the system features, 125%be it to customise it, build separate applications or include 126%new features. 127%Most of the built-in predicates can be modified by the user, 128%several user-definable events allow the user to 129%modify the Prolog top-level loop. 130% 131%\subsection{User Interface} 132%The interface is user-friendly, e.g., in the top-level and in the debugger 133%most functionalities can be accessed with a single key stroke. 134%The top-level loop does not ask for displaying more alternatives 135%when it can determine that there are none. 136%All user interface errors are signaled to the user instead of just failing 137%so that it is easy to spot trivial errors like misspelling 138%a predicate or variable name. 139%\index{name completion} 140%Automatic name completion is provided: 141%when the user types the first characters of 142%an atom or functor followed by \verb.^.D, the system will try to 143%complete the input from the known atoms and functors in the dictionary. 144%For example {\tt gar}\verb.^.D will be expanded into {\tt garbage_collect}. 145% 146%\subsection{Full Word Size} 147%Unlike other Prolog systems, {\eclipse} does not use several bits 148%of a 'Prolog word' for a tag and so its data types are fully compatible 149%with external software and it can represent numbers, pointers etc. 150%without any restriction. 151% 152%\subsection{Few Limits} 153%All {\eclipse} memory areas are automatically extended when necessary. 154%There are no limits (other than the available memory) to 155%the size of atoms or strings or their number, 156%the length of integers, 157%the arity of structures is unlimited 158%and there are no limits on the complexity of compiled clauses. 159% 160%\subsection{Occur Check and Complete Search Rule} 161%\index{occur check} 162%\index{depth-first iterative deepening} 163%\index{Horn clause logic} 164%Most Prolog systems implement logic programming only incompletely, 165%because they omit the occur check and use only the depth-first 166%search. {\eclipse} offers a complete system for Horn clause logic 167%by providing optional compiler support for 168%the occur check and for the depth-first iterative deepening search rule. 169% 170%\subsection{Strings} 171%\index{strings} 172%{\eclipse} has the data type {\it string} whose representation 173%is compact and compatible with strings in C, but it also 174%supports lists of ASCII codes. 175% 176%\subsection{Arrays and Global Variables} 177%\index{arrays} 178%\index{global variables} 179%For special purposes and for communication with external 180%software it is possible to use (extra-logical) arrays of various types 181%and global variables which can be modified with destructive 182%assignment. 183%For instance, the implementation of a counter using a global variable 184%is much faster and uses less space than using \bipref{assert/1}{../bips/kernel/dynamic/assert-1.html}. 185%The arrays map on C structures and they can be manipulated 186%in external predicates. 187%The global array and variable names are module sensitive. 188% 189%\subsection{Indexed Database} 190%\index{records} 191%{\eclipse} contains the {\bf record} family of predicates which allow 192%to store several terms under a specified key. 193%There a two sets of predicates for the indexed database. 194%One provides {\it database references} as used in Cprolog, the other 195%works with keys only. 196%The indexed database keys are module sensitive. 197% 198%\subsection{Modules} 199%{\eclipse} has a sophisticated module concept which makes it possible to 200%build large applications, avoid name clashes and to hide information 201%from unauthorised access. 202%The items covered by the module system's visibility rules are predicates, 203%global variables and arrays, indexed database keys, operators and 204%macro transformations. 205% 206%\subsection{Event Handling} 207%{\eclipse} can handle synchronous events ({\bf exceptions}) and 208%asynchronous ones ({\bf interrupts}). 209%An exception can be a wrong argument type, calling undefined predicate, 210%reading past the file end, etc. 211%When an event occurs, the corresponding {\it event handler} is called, 212%which is a user-definable procedure. 213%All built-in predicates raise an event when a nonstandard situation 214%occurs, be it an error or a situation where several actions 215%would be possible and the user has the possibility to influence 216%it by defining an appropriate event handler. 217% 218%When an interrupt occurs, e.g., a signal, the current execution 219%is interrupted and the signal is handled immediately in real time. 220%This feature can be used to write real-time applications, 221%for example graphics applications which make use of a mouse etc. 222% 223%\subsection{Coroutining} 224%The user can express a condition under which a call to a specified 225%procedure will be delayed. 226%This condition can be expressed in a normal Prolog form using 227%unification and predicate calls. 228%The delayed predicates are resumed when one of the specified 229%variables is bound and the delay condition is then verified again. 230%This goal suspension can be used to preserve completeness 231%e.g., when avoiding infinite loops, to increase efficiency 232%by reordering subgoals, to have sound negation 233%and to implement coroutines. 234% 235%The user can also process suspensions explicitly which makes it 236%possible to implement almost any control strategy. 237% 238%\subsection{Debugger} 239%{\eclipse} includes a built-in debugger which debugs 240%compiled code without {\it metainterpreting} it 241%(i.e., the debugger is not a Prolog program which would 242%simulate the execution of another program) and so the 243%debugged code is not considerably slower than the not debugged one 244%as is the case in most other Prolog systems. 245%It also allows tracing the special {\eclipse} features. 246%It is able to trace suspended goals, skip to the place 247%where a suspended goal has been woken, trace event handlers, 248%etc. and it has a comfortable user interface which can be easily 249%connected with a windowing environment. 250%The user can define macros of debugger commands, repeat them and 251%set various leash modes of ports and procedures. 252%Debugger events can be used to define conditional spy points, 253%manipulate the goal variables etc. 254% 255%\subsection{Stream I/O} 256%The {\eclipse} I/O is based on the concept of {\it streams} 257%which are mapped on the I/O channels of the underlying operating system. 258%Apart from user-definable streams there are several predefined 259%system streams like {\it toplevel_output}, {\it debug_input} etc. 260%which make it easy to filter the data of a certain kind, 261%connect it with a windowing environment or to use it in 262%event handlers. 263%Any input stream can be passed as input to the compiler. 264%Furthermore {\eclipse} supports I/O in raw mode and I/O to and from a string. 265% 266%\subsection{Macros} 267%{\eclipse} provides a very general macro mechanism that can be used to transform 268%terms and program clauses while they are read into the system 269%and before they are printed out. 270% 271%\subsection{Blocks} 272%Blocks as suggested by the ISO draft \cite{ISO} are supported 273%by {\eclipse}. 274%It is a mechanism similar to LISP's catch\&throw, it allows 275%to abandon the execution of a goal, return to a specified ancestor 276%and call another procedure instead. 277% 278%%\subsection{Sound and Constructive Negation} 279%%In addition to the usual {\it negation by failure}, 280%%{\eclipse} contains the {\it sound negation}, similar to that provided by MU-Prolog 281%%and also {\it constructive negation}. 282%%Constructive negation can be used to generate solutions 283%%for negated goals and thus it is logically complete and sound. 284%%It uses delayed goals to express constraints on 285%%the variables in a negated query, so that e.g., 286%%when a fact {\it p(a)} exists, the goal 287%%{\it ?-neg p(X)} will yield a solution {\it X $\neq$ a} 288%%\footnote{ 289%%For impatient users: before trying out this example 290%%consult page \pageref{cnpage} how to load the appropriate library.}. 291% 292%\subsection{External Predicates} 293%{\eclipse} can interface 294%to any external function written in C and load it dynamically 295%if required\footnote{The dynamic loading feature may not be available 296%on certain machines}, 297%the C function can manipulate Prolog data, or it might 298%be completely independent of Prolog structures. 299%All C data can be mapped on Prolog data, in particular C structures 300%correspond to {\eclipse} arrays. 301%As in other Prolog systems, 302%external procedures may succeed or fail, 303%but {\eclipse} also offers the ability to backtrack, delay and 304%call Prolog procedures from an external one. 305%These features make the external predicates a powerful 306%tool for the integration of non-Prolog data and control into {\eclipse}. 307% 308%\subsection{Compatibility} 309%{\eclipse}'s flexible syntax and the extensive use of its event handling 310%capabilities allows it to build compatibility packages for programs 311%written in other Prolog dialects. 312%Currently packages are provided for C-Prolog, Quintus Prolog 313%SICStus Prolog and the old BSI standard draft. 314%Many of the system parameters can be modified by changing 315%internal flags. 316% 317%\subsection{Autoloading Libraries} 318%\index{autoloading} 319%{\eclipse} supports autoloading libraries of Prolog predicates. 320%When a predicate is declared as autoloading, it is loaded 321%from the corresponding file in the library path when it is 322%called for the first time. 323%User libraries are supported, the library path can contain 324%any user directories. 325% 326%\subsection{Profiling Tools} 327%\index{profiling} 328%Two tools are provided to analyse program runs and extract 329%information for performance improvements. 330%One is a port-model based analyser which produces statistics 331%about how many times a program passed every debugger port. 332%The other is a true timing profiler which measures the time spent in 333%every predicate of a program. The latter works even on optimized compiled code. 334% 335%\subsection{Portability} 336%\sepia and {\eclipse} have been developed on a Sun-4 and 337%ported to VAXes, 338%Apollo, Bull DPX machines and Siemens MX-300 and MX-500. 339%Apart from the 340%software implementation of \sepia, the Computer Architecture Group at ECRC 341%developed a hardware implementation termed the {\it Knowledge Crunching Machine} 342%(KCM) \cite{benker89}. 343% 344%\subsection{On-line Documentation} 345%The {\eclipse} Prolog Built-in Predicate Reference Manual 346%(BIP book \cite{sepiabipbook}) is available on-line. 347%Calling {\tt help(PredSpec)} will display the appropriate manual page, 348%containing a detailed description of the specified built-in predicate. 349% 350%\section{Extensions} 351%{\eclipse} has been designed as a basis for various extensions 352%%of Prolog which may even go beyond the scope of logic programming. 353%%\index{OPIUM} 354%The various Constraints Logic Programming libraries 355%are examples of successful systems based on {\eclipse}'s extensibility: 356%\begin{description} 357%\item [library(fd)] finite-domain constraint solver 358%\item [library(r)] linear rational arithmetic constraint solver 359%\item [library(chr)] constraint handling rules system 360%\item [library(propia)] generalized propagation system 361%\item [library(conjunto)] finite sets constraint solver 362%\end{description} 363 364\section{Further Information} 365{\eclipse} was initially developed at the European Computer-Industry 366Research Centre (ECRC) in Munich, and then at IC-Parc, Imperial College in London 367until the end of 2005. It is now an open-source project, with the 368support of Cisco Systems. 369Up-to-date information can be obtained from the {\eclipse} web site 370\begin{quote} 371\begin{verbatim} 372http://www.eclipseclp.org 373\end{verbatim} 374\end{quote} 375or from the Sourceforge site under the project name {\bf eclipse-clp} 376\begin{quote} 377\begin{verbatim} 378http://www.sourceforge.net/projects/eclipse-clp 379\end{verbatim} 380\end{quote} 381which also hosts the main source repository. 382There you can also subscribe to the {\eclipse} user group mailing list 383or access its archives.% 384\index{user group}% 385\index{mailing list} 386\begin{quote} 387\begin{verbatim} 388eclipse-clp-users@lists.sf.net 389\end{verbatim} 390\end{quote} 391 392\section{Reporting Problems} 393In order to make {\eclipse} as useful and reliable as possible, 394we would like to encourage users to submit problem reports via the web site 395\begin{quote} 396\begin{verbatim} 397http://eclipseclp.org/bugs.html 398\end{verbatim} 399\end{quote} 400or by e-mail to 401\begin{quote} 402\begin{verbatim} 403eclipse-clp-bugs@lists.sf.net 404\end{verbatim} 405\end{quote} 406\index{bug reports} 407%HEVEA\cutend 408