In this work, the integration of
is presented. The extension of LL with PROLOG-like structures is necessary
in order to permit both sublanguages to work on the same data types.
- relational languages (with REL as a representative) and
- LL (LISP light),
a subset of COMMON LISP extended with PROLOG-like structures,
This integration is carried out on two levels:
- On the abstract machine level:
The WAM [\protect\citeauthoryearWarren1983], the abstract
machine which has turned
out to be a (local) optimum for the compilation
of relational languages,
is (loosely) coupled with the LLAMA (LISP
light Abstract Machine),
an abstract stack machine especially
designed for the efficient execution of LL programs while handling all
PROLOG data structures (as they are internally represented)
to avoid their transformation at run time.
The integration of the WAM and the LLAMA was carried out with the
help of the GAMA, a General Abstract
Machine Assembler, intended as a programming
environment supporting the development and integration
of abstract machines.
- On the source language level:
- As a result of the integration of the two underlying
abstract machines, relational programs compiled into the WAM
and LL programs compiled into the LLAMA can access each
relations access LL functions via a generalized
is builtin, allowing not only
arithmetical builtins (as in PROLOG)
but also LL functions on the right-hand side, and
LL functions access relations, either
with once (retrieving only the
first solution), or with
a bagof-like construct
(retrieving all solutions).
- Relations that are (detected or declared
to be) only
used deterministically are
transformed into LL functions and then compiled into LLAMA code,
thus avoiding the overhead caused by the ordinary WAM code.
The following diagram, a refinement of the diagram on page
illustrates the integration of relational languages and LL
on both the source language and the abstract machine level (parts newly
developed in this work are marked with *):
This approach meets all the requirements presented in the preceding
- Applications in which either the logic or the functional
programming paradigm is best suited for some sub-problems can
be developed in a relational language coupled with LL.
- Already existing programs in relational
languages and LISP can be integrated
without re-implementation. Since PROLOG and
COMMON LISP are the predominant logic and functional programming languages,
mainly subsets of these languages have been chosen.
- By mapping deterministic predicates into LL functions,
the efficiency of relational programs can often be considerably improved
(by a factor of 2-4; see appendix A).
Especially, large relational applications tend to contain
a huge number of deterministic predicates, as we were able to determine
via some of our RELFUN programs
- The expressiveness of relational programs
can be improved by specifying new features as LL functions and using them
as pseudo builtins.
Compared with more theoretically motivated approaches using a
tight integration of
logic and functional languages on the source and the abstract machine
our approach has the following strong points:
- Already existing programs in PROLOG and LISP do not
have to be re-implemented in a new, unified formalism.
- For applications requiring additional programming paradigms,
further abstract machines can be coupled with the WAM and the
LLAMA without much effort.
- The loose coupling of the WAM and the LLAMA allows new insights
in the technology of the WAM or stack machines to be