The user interface of compiled CLP( ) is very much like that of a usual
Edinburgh-style Prolog interpreter. In other words, it is quite possible to
use this system while almost completely ignoring the fact that it is
compiler-based.
In fact, there is no such thing as an interpreted mode and all code
(static and dynamic) is compiled.
All goals are compiled (quickly) before being executed, and any consulted file
is immediately compiled. The rulebase is available for inspection (except
for protected rules) and
can be modified dynamically as long as the relevant relations have been
declared to be dynamic as described below. Normally the user will
find that consulted files take a little longer than usual to be read in
(because they are being compiled) and that programs will usually
run much more quickly and use less space than in an interpreter. Symbolic
debugging is still possible, as are all other aspects of interactive
programming. However, the user may also take special advantage of the compiler
by creating clam files that contain compiled CLP(
) code that can be
loaded extremely quickly and do not include the overhead of the
original program text, although this rules out certain operations.
In short, the system is intended to get the best of both worlds by combining
the flexibility of an interpreter with the efficiency of a compiler.
The experienced PROLOG user may want to skip directly to
Section 4.6 which illustrates many of the features,
syntax and user interface of CLP(
) using an example session.
The first operation CLP( ) performs
is to load the distinguished library file
init.clpr.
This file must either be in the current working directory,
or in a directory whose path name is defined via the environment
variable CLPRLIB,
or in a directory whose path name is specified
during installation. This last alternative is explained
in Chapter 6.