next up previous
Next: The output stage
Up: The compiler
Previous: The parser

The code-generator

The code-generator translates the parser's abstract-syntax tree into a ``target-code tree'', a structure representing the code to be output. Although the current compiler emits Object Rexx, this is not an essential part of the design. To make the compiler as portable as possible, therefore, the target-code tree is Rexx-independent, and there is another stage, described below, which outputs it.

The code-generator sometimes has to subclass existing class definitions. For example, if a program contains a <WOMForm> with an <OnSubmit>, the code must be obeyed whenever the form is resubmitted. The most convenient place to put it is inside an update method belonging to the form. Since all forms will have different update methods, they all need to be implemented as different classes.

Jocelyn Ireson-Paine
Fri May 30 14:03:06 BST 1997