The compilation of RELFUN clauses into WAM code is done in several steps; the user interface enables to execute each step or groups of compatible steps separately.
The complete compiler is invoked by the compile command; it can be called with an extra argument for compiling a single procedure, thus allowing procedure-based incremental compilation. The compile command is divided into two stages, the precompilation (horizontal transformations) and the proper compilation (vertical translations). The horizontal transformations are performed by the horizon command, the vertical translations by the verti command.
horizon is itself divided into two parts, extron and bastron. The extron transformations undeclare, untype, unmacro, and unor map into extended constructs, in particular lambda expressions, which are then further transformed by unlamda and uncomma into a RELFUN subset (these are described in section 3.1). The bastron transformations convert these reduced RELFUN clauses into an even smaller subset that is ready for the vertical transformations. E.g. at the time of the verti command all tups will have been transformed into cns structures via the untup command; it is also assumed that only flattened clauses are in the database, which is performed by the flatter command (the bastron transformations are described in section 3.2).
verti consists of two phases, the classifier and the code generator. Like in horizon these phases can also be called explicitely by typing classify and codegen. The classify command collects all clauses starting with the same name and arity, and groups them together on the property list of the symbol determined by the procedure name, using the tag clauses. This is necessary because the basic entity in the WAM is a group of clauses with the same name and arity, called a `procedure'. After this, the classified clauses are generated and stored in a global variable called *classified-database*. The codegen command reads the contents of *classified-database* and produces GWAM code from it.
It is possible to pretty print the classified clauses by typing listclass and the code with the listcode command.