The Generation of Concurrent Code for Declarative Languages

N.J. Rothwell

Abstract: This 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 F-HYBRID, a strongly typed applicative language, and for L-HYBRID, a concurrent, nondeterministic logic language.

An approach is presented for F-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 L-HYBRID, a dialect of the nondeterministic logic language Concurrent Prolog. The language is embedded within the applicative language F-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 L-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 information in data structures.

Ph.D. Thesis - Price £7.50

LFCS report ECS-LFCS-87-37

Previous | Index | Next