An algebraic approach to compiler design
نویسنده
چکیده
The general purpose of this thesis is to inve8tigate the design of compilers for procedu ralla.nguagea, based on the algebraic la.ws which these langua.ges sa.tisfy. The particular stra.tegy adopted is to reduce an arbitrary source progrQlIl to a nonna! form which de scribes precisely the beha.viour of the ta.rget machine. This is achieved by a. series of algebraic transformations which are proved from the more basic laws. The correctness of the oompiler follows from the correctness of each algebraic transforma.tion. The entire process is formalised within this single a.nd uniform semantic framework of a. procedural language a.nd its algebraic la.ws. But in order to atta.in abstraction and more reasoning power, the language comprises specification features, in addition to the programming constructs to be implemented. These features are used to define a very general normal fonn, capable of representing an arbitrary target machine. The normal form reduction theorems can therefore be reused. in the design of compilers which produce code for distinct target machines. A central notion is an ordering relation on programs: p r: q means that q is at least as good as p in the sense that it will meet every purpose and satisfy every specification satisfied by p. Furthermore, substitution of q for p in any context is an improvement (or at least will leave things unchanged when q is semantically equivalent to p). The compiling task is thereby simplified to finding a normal form that is not just the same but is allowed to be better than the original source code. Moreover, at all intermediate stages, we can postpone details of implementation until the most appropriate time to make the relevant design decisions. Dijkstra's guarded conuDand language is used to illustrate how a complete compiler can be developed, up to the level of instructions for a simple target ma.c.hine. Each feature of the language is dealt with by a separate reduction theorem, which is the basis for the modularity of the approach. We then show how more elaborate features such as procedures and recur5ion can be handled in complete isolation from the simpler features of the language. Although the emphasis is on the compilation of control strudures, we develop a scheme for compiling arrays. This is also an incremental extension in the sense that it has no effect on the features already implemented. A large subset of the theory is mechanised. as a collection of algebraic structures in the OBJ3 term rewriting system. The reduction theoreIllB are used as rewrite rolell to carry out compilation automatically. The overall structure of the original theory is preserved in the mechanisation. This is largely due to the powerful module system of OBJ3.
منابع مشابه
Implementing Extensible Compilers
New extensions to programming languages are constantly being proposed. But implementing these extensions usually turns out to be a very difficult and expensive task, since conventional compilers often lack extensibility and reusability. In this paper we present some fundamental techniques to implement extensible compilers in an object-oriented language. For being able to implement extensible co...
متن کاملAlgebraic Implementation of Model Checking
We apply the algebraic methodology for compiler design and implementation to deduce an algebraic speci cation and implementation of a CTL model checker algorithm. For that we start by observing that an algebraic compiler C : Ls ! Lt is a language-to-language translator embedding a source language Ls into a target language Lt. We take the source language to be the set of CTL formulas for a given...
متن کاملScientific Flow Field Simulation of Cruciform Missiles Through the Thin Layer Navier Stokes Equations
The thin-layer Navier-Stokes equations are solved for two complete missile configurations on an IBM 3090-200 vectro-facility supercomputer. The conservation form of the three-dimensional equations, written in generalized coordinates, are finite differenced and solved on a body-fitted curvilinear grid system developed in conjunction with the flowfield solver. The numerical procedure is based on ...
متن کاملAlgebraic Frameworks for Probabilistic and Concurrent Systems
Formal methods have been extensively used and studied in the area of theoretical computer science ultimately with the aim of providing the technical foundations to justify design methods for producing high quality software systems. Formal methods provide a way to write specifications of required behaviour together with rules to check that the implementation’s behaviour is consistent with that o...
متن کاملRecent Developments in Discrete Event Systems
This article is a brief exposure of the process approach to a newly emerging area called "discrete event systems" in control theory and summarizes some of the recent developments in this area. Discrete event systems is an area of research that is developing within the interstices of computer, control and communication sciences. The basic direction of research addresses issues in the analysis an...
متن کامل