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.