Static analysis based on denotational transformations

Margaret Montenyohl · 1986

Ideally, a language's implementation should be based on a formal definition of its semantics. Typically, a language is defined by its a compiler. We believe the reverse situation is possible and the work reported here suggests ways of managing the task of correct compiler design. In this dissertation, we show how a provably correct implementation may be constructed from a denotational definition of the source language. Wand has developed a methodology for deriving target code by applying meaning-preserving transformations to a language's semantic definition Wand, 80,82a,82b,83 . The correctness proof is straightforward; it is based on the direct connection between the functions specifying the meaning of the constructs and the representations of the constructs. By extending Wand's methodology, we develop a specification of a compiler which performs data flow analysis in order to produce more efficient target code. Specifically, we derive a compiling algorithm which performs type-checking before code generation so that type-checking instructions may be omitted from the target code. The optimized code is proved correct with respect to the semantics of the original program. The proof consists of showing that each transformation applied to the original definition preserves its meaning. Also, we include constant folding and live variable analysis in our compiler specification. Developing a comprehensive, theoretical model of compilation is important to language designers and implementers because by studying the issues of compilation in a formal model, they will be better prepared to design and write good compilers. By showing how static analysis and code optimization may be specified in a denotational framework, we give support to the hypothesis that denotational semantics is an appropriate notation in which to develop a formal model of compilation. Further, we construct an implementation from our model using a transformational approach. Since the notation has a theoretical basis, we give a proof of the correctness of our implementation. The transformations used to develop our implementation are structured in such a way that automation seems possible. Thus our results are significant to the study of semantics-directed compiler generation.

Read the paper · More papers on PaperTik