The compilation of RELFUN programs consists of two main stages, horizontal transformations and vertical translations. The horizontal transformer is divided into several steps, whose target is mainly a simpler subset of RELFUN, but for advanced features can also be extended representations. The ensuing vertical translator is divided into two stages, the classifier and the code generator. The classifier transforms RELFUN source clauses to so-called ``Classified Clauses''; from these WAM-annotated clauses the code generator can almost `read off' the WAM code (see below).
All compilation steps can be used separately, as a compilation laboratory, as well as batch-composed, as a complete RELFUN compiler. Of course, various groups of these steps could be joined into single steps for optimizing compilation time. But organizing the compiler into such steps enhances its modularity and readability, which helps in the development of optimizations of execution time, our main concern.
Both emulators are extensions of the WAM (Warren Abstract Machine). The first emulator is called GWAM (Generalized WAM [Sin95]), the successor to the NyWAM [Hei89], which originated from Nystrøm's WAM [Nys]. The GWAM is built in COMMON LISP on a general implementation platform, the GAMA (General Abstract Machine [Sin95]), which contains a debugger, an assembler, and a loader. The second emulator is called RAWAM (Relfun Adapted WAM), more based on [AK91], and built in ANSI C [Per96].
It is assumed that the reader be somewhat familiar with RELFUN (see [BAE 96]), and with WAM architectures ([War83], [AK91], [VR94]). For further information about the RFM see [Bol92] [Kra90], [Hei89], [Els90].
The user interface of the RFM is described in section 2. The horizontal transformations are the subject of section 3.1. Sections 4 and 5 treat the classifier and code generator for vertical translations; sections 6 and 7, the GAMA and the embedded GWAM emulator. The last section contains an example dialog that will show some aspects of the compiler/emulator system `live'.