PhD ThesisThis thesis presents an approach to the implementation of declarative languages
on a simple, general purpose concurrent architecture. The safe exploitation of
the available concurrency is managed by relatively sophisticated code generation
techniques to transform programs into an intermediate concurrent machine
code. Compilation techniques are discussed for 1'-HYBRID, a strongly typed
applicative language, and for 'c-HYBRID, a concurrent, nondeterministic logic
language.
An approach is presented for 1'- HYBRID whereby the style of programming
influences the concurrency utilised when a program executes. Code transformation
techniques are presented which generalise tail-recursion optimisation,
allowing many recursive functions to be modelled by perpetual processes. A
scheme is also presented to allow parallelism to be increased by the use of local
declarations, and constrained by the use of special forms of identity function.
In order to preserve determinism in the language, a novel fault handling
mechanism is used, whereby exceptions generated at run-time are treated as a
special class of values within the language.
A description is given of ,C-HYBRID, a dialect of the nondeterministic logic
language Concurrent Prolog. The language is embedded within the applicative
language 1'-HYBRID, yielding a combined applicative and logic programming
language. Various cross-calling techniques are described, including the use of
applicative scoping rules to allow local logical assertions.
A description is given of a polymorphic typechecking algorithm for logic
programs, which allows different instances of clauses to unify objects of different
types. The concept of a method is derived to allow unification Information to
be passed as an implicit argument to clauses which require it. In addition,
the typechecking algorithm permits higher-order objects such as functions to be
passed within arguments to clauses.
Using Concurrent Prolog's model of concurrency, techniques are described
which permit compilation of 'c-HYBRID programs to abstract machine code derived
from that used for the applicative language. The use of methods allows
polymorphic logic programs to execute without the need for run-time type information
in data structures.The Science and Engineering Research Council