Publication
Theoretical Computer Science
Paper

More on advice on structuring compilers and proving them correct

View publication

Abstract

Following Lockwood Morris, a method for algebraically structuring a compiler and proving it correct is described. An example language with block structure and side-effects is presented. This determines an initial many-sorted algebra L which is the 'abstract syntax' of the example language. Then the semantics of L is completely determined by describing a semantic algebra M 'similar' to L. In particular, initiality of L ensures that there is a unique homomorphism Lsem:L→>M. This is algebraically structuring the semantic definition of the language. A category of flow-charts over a stack machine is used as a target language for the purposes of compilation. The semantics of the flow charts (Tsem:T→S) is also algebraically determined given interpretations of the primitive operations on the stack and store. The homomorphism comp:L→ T is the compiler which is also uniquely determined by presenting an algebra T of flowcharts similar to L. This is algebraically structuring the compiler. Finally a function encode:M→S describes source meanings in terms of target meanings. The proof that the compiler is correct reduces to a proof that encode:M→S is a homomorphism; then both comp {ring operator} Tsem and Lsem {ring operator} encode are homomorphisms from L to S and they must be equal because there is only one homomorphism from L to S. © 1981.

Date

01 Jan 1981

Publication

Theoretical Computer Science

Authors

Topics

Share