Summary: 0 0
SemanticsDirected Code Generation
Andrew W. Appel
The intermediate representations (IR) used by most compilers have an operational
semantics. The nodes in the graph (or tree, or quadcode sequence) have an interpreta
tion as the operation codes of some abstract machine.
A denotational semantics, in which each node in the IR graph has a static meaning,
can lead to a clean interface between the front and back ends of the compiler. Further
more, it is possible to concisely specify a code generator to translate the denotational
representation into machine code. Combined with recent work allowing the denotational
specification of front ends to translate the input language into the IR, a complete compiler
with a welldefined semantics may be generated.
Using this technique, compilers have been written for (most of) Pascal and C
which, although they compile slowly, produce fairly good machine code.
July 25, 1984