|
|
Example 7
In this example, at code generator generation
time, tables are created which describe abstract syntax tree patterns to
be matched (at code generation time) and the code to be generated. Thus,
the pattern for an abstract syntax (sub) tree node whose root is a *
operator and whose children are a symbol and a
constant, is stored together with the code that gets the next
the next available register and emits a move instructiom and a
multiply instruction.
At code generation time, when an abstract syntax tree that matches this is
input, the code is output. This is called retargetable since the
tables can be easily changed to output code for another machine.
|