Papers on Poly/ML

Preface: Various papers and research documents have been
written while the Poly/ML project was underway and now that the
project is completed it seemed appropriate to combine them into a
single document. Some of these papers have been published, while
others were written simply to help clarify thoughts on a particular
subject.

Poly/ML started in 1983 when Dr Mike Gordon suggested
that I should try to implement the Standard ML language which was
then being designed by a group being led by Prof. Robin
Milner. At that stage the core of the language had been
more-or-less fixed though there was still no facility for
modules.

I had finished a compiler for Poly written in Poly and had it
running on a Vax. The compiler consisted of four sections. The
first part was a parser and type-checker for Poly. The second
section took the Poly parse tree and generated an intermediate code
tree structure. The third phase was an optimiser which worked on
the code tree, and in particular expanded inline functions, and the
final section was a code generator producing the Vax machine-code.
The whole compiler ran under a persistent storage system.

Although Poly and ML have different syntax and type-systems
their execution models are remarkably similar. A new parser and
type-checker had to be written but the code-generator and optimiser
could be shared between Poly and ML. The same run-time system was
used.

By the end of 1983 an experimental version of Poly/ML was
running and being tested in the Computer Laboratory by Dr Larry Paulson and by
Prof. Mike
Fourman, then at Brunel.
Subsequently there has been work in a number of areas. The ML
language has changed and in particular a mechanism for modules has
been added. The system has been ported to the Sun computer which necessitated a new
code-generator and substantial changes to the run-time system.
Recently a window system and parallel processes have been
added.

What lessons have been learned from the project? Poly turned out
to be an excellent language for the project. Modules based around
Poly abstract types were used extensively. The lack of the kind of
low-level ``bit-twiddling'' operations of a language like C was not
a problem even in the machine-code generators. In practice
compilers involve very few such low-level operations. Polymorphic
operations were used extensively. Occasionally it would have been
nice to use polytypes as in ML rather than having to explicitly
declare instances of types, however there was at least one case
where a polymorphic function was written in Poly which could not
have been written in ML (because a polymorphic function in ML
cannot contain a recursive application to a specific type).

The papers in this report have been grouped into sections
according to their likely audience. The first section describes the
Poly/ML system and the extensions for windows and processes. This
section is likely to be of most interest to users of Poly/ML.

Section 2 contains various discussion papers about Poly and ML.
Some of the ideas covered were never actually implemented, in
particular the work on structure editing.

The third section contains two papers on the persistent storage
system and its implementation.

The final section covers the implementation of Poly and ML and
the run-time system. The papers in this section describe the
internals of the compiler and the run-time system.