This thesis has been submitted in fulfilment of the requirements for a postgraduate degree (e.g. PhD, MPhil, DClinPsychol) at the University of Edinburgh. Please note the following terms and conditions of use: • This work is protected by copyright and other intellectual property rights, which are retained by the thesis author, unless otherwise stated. • A copy can be downloaded for personal non-commercial research or study, without prior permission or charge. • This thesis cannot be reproduced or quoted extensively from without first obtaining permission in writing from the author. • The content must not be changed in any way or sold commercially in any format or medium without the formal permission of the author. • When referring to this work, full bibliographic details including the author, title, awarding institution and date of the thesis must be given. AN OPERATIONAL APPROACH TO SEMANTICS AND TRANSLA7 FOR CONCURRENT PROGRAMMING LANGUAGES by Wei Li Doctor of Philosophy University of Edinburgh 1982 1 Abstract The problems of semantics and translation for concurrent programming languages are studied in this thesis. A structural operational approach is introduced to specify the semantics of parallelism and communication. Using this approach, semantics for the concurrent programming languages CSP (Hoare's Communicating Sequential Processes), multitasking and exception handling in Ada, Brinch-Hansen's Edison and CCS (Milner's Calculus of Communicating Systems) are defined and some of their properties are studied. An operational translation theory for concurrent programming languages is given. The concept of the correctness of a translation is formalised, the problem of composing transitions is studied and a composition theorem is proved. A set of sufficient conditions for proving the correctness of a translation is given. A syntax-directed translation from CSP to CCS is given and proved correct. Through this example the proof techniques of this approach is demonstrated. Finally, as an application of operational semantics and translation, a proposal for implementing multitasking in Ada is given via a two-step syntax-directed translation. 2 Acknowledgements I would like most of all to express my gratitude to my supervisor, Gordon Plotkin. His guidance, encouragement, detailed suggestions and patient reading of this thesis have had a fundamental influence on the development of this research. I am also very grateful to Matthew Hennessy and Robin Milner for acting as supervisors whilst Gordon was away. It is hard to say sufficiently how much I have benefitted from the help of my colleagues at Edinburgh. I would like to thank all those involved in the theory of computation, especially Don Sannella and Mark Millington for helpful discussions, useful suggestions and patiently reading my thesis. Special thanks to my wife Rua and my daughter Gong. Without their sympathetic understanding, moral encouragement and self-sacrifice the thesis could not have been written. The work here was supported in part by a studentship from the Education Ministry of China, and in part by a studentship from the University of Edinburgh. Declaration This thesis was composed by myself. Chapter 2 is essentially an improved version of a paper written by Gordon Plotkin (see [Plotkin 821). Early versions of parts of Chapter 3 are published in (Hennessy and Li 821 and [Li 82]. An early version of a part of Chapter 6 is published in [Hennessy, Li and Plotkin 811. Otherwise the work is my own, under the guidance of my supervisor Gordon Plotkin. 3 CONTENTS 0. Introduction 1. Labelled transition relations and operational semantics 1.1 Labelled transition relation 1.2 Labelled transition system 1.3 Evaluating arithmetic expressions 1.4 An operational semantics of CCS 1.4.1 The syntax of CCS 1.4.2 An operational semantics of CCS 1.4.3 Examples 2. An operational semantics of CSP 2.1 The syntax of CSP 2.2 Static semantics 2.3 An operational semantics 2.4 Properties and examples 2.5 Further discussions 3. An operational semantics for Ada multitasking and exception handling 3.1 An outline of multitasking and exceptions in Ada 3.1.1 Multitasking in Ada 3.1.2 Exception in Ada 3.2 An operational semantics for multitasking in Ada 3.2.1 The syntax of Ada.1 3.2.2 Static semantics 3.2.3 Operational semantics 3.2.4 Properties and examples 3.3 Exception handling in the sequential case of Ada 3.4 Interaction between exceptions and task communication 4 4. An operational semantics of Edison 4.1 The syntax of Edison.l 4.2 Static semantics 4.3 Operational semantics 5. An operational translation theory 5.1 Translation and its correctness 5.2 Congruence relation on transition systems 5.3 Adequate translation 6. Translating CSP into CCS 6.1 An intermediate CCS 6.2 Translation from CSP to CCS 6.2.1 Useful notation 6.2.2 Restricted CSP 6.2.3 Syntactic translation 6.2.4 Semantics translation 6.3 Proving the adequacy 6.3.1, Useful Lemmas 6.3.2 Proving the adequacy 7. A proposal for implementing Ada multitasking 7.1 A translation from Ada.1 to Edison.1 7.3 Implementing Ada multitasking 7.3.1 An introduction to Edison.0 7.3.2 A translation from Ada.1 to Edison.0 8. Conclusion Appendix 1 The proofs of lemmas about before and par References s 0. Introduction A number of programming languages intended to describe concurrent computations have been proposed in the last decade. These languages are called concurrent programming languages. Their number is not as great as that of strictly sequential languages but the number is increasing yearly. Among them, Communicating Sequential Processes ([Hoare 7,8]), Ada ([DoD 80]), Edison ([Brinch-Hansen 81]) and Calculus of Communication Systems ([Milner 80]) are the most influential and typical representatives. The first three are imperative languages and the last is an applicative language. Lively research has grown up rapidly around these languages. Most of this research can be categorised into the following three areas: A. Formalising the semantics of parallelism and communication. B. Implementing concurrent programming languages and proving the correctness of the implementation. C. Construction and verification of concurrent programs. This thesis attacks the first two problems. For the first problem, we know that in sequential languages there are four basic approaches: denotational semantics, algebraic semantics, axiomatic semantics and operational semantics. Each of these four approaches is also being applied to describing the semantics of concurrency. We will study the semantics problem using an operational approach. Roughly speaking, the operational approach is to formally describe the execution of programs, i.e. to formalise the "operational nature" of programs. In general this purpose is 6 achieved by specifying some convenient abstract machine and modelling the execution of programs on that machine. This can give a hint of the way the language can be implemented. One merit of the operational approach is that since the essential feature is to formalise the "operational nature" of programs, if a language can be implemented then its operational semantics, in principle, should be definable. In general an operational semantics differs from other approaches in that it does not require a lot of heavy mathematical machinery and is easy to understand. The weakness of operational semantics is that because the semantics is based on an abstract machine it usually specifies some irrelevant details. This tends to make the semantics of any nontrivial language very obscure and detailed from the mathematical point of view. To overcome this weakness or at least to reduce it to a minimum, in this thesis we introduce a new operational approach --- -the structural operational approach or axiomatic operational approach developed by Plotkin and his colleagues. The basic ideas of this approach are: a. To abstract away from the irrelevant details of the abstract machines we adopt some of the successful features of the denotational approach such as the use of abstract syntax to replace concrete syntax, and the viewing of states (stores) and environments as functions. Thus a simple configuration of an abstract machine can be written as <S,s> or <S,p,s> where S denotes the current statement to be executed, and p and s 7 denotes the current environment and state. Some other possible configurations are s (denoting normal termination resulting in the state s) and abortion (denoting abnormal termination). We use r to denote the set of all possible configurations. Furthermore, to distinguish the successful executions from other computations (deadlocked and infinite computations) we introduce the set T of terminal configurations which is a subset of r . For example, we can take T = States u{abortion) c r b. We use labelled transition relations to model computation; thus a transition: r-->r' models one elementary execution step. This transition is interpreted as the configuration r "may perform action ). to become r' " or r "is transformed to r' via the action V. Here the action ). denotes an internal action or interactive communication with some super system or the outside world. Thus communication between concurrent "processes" can easily be captured and formalized by labelled transitions. Let A be the set of possible transition actions. Then the labelled transition relation )=_rXAXr describes the possible executions of programs. Execution of a program can be viewed as a transition sequence: r0 1 X2 >r2 X3 ll .. 8 which is either infinite or finite. The crux of the matter lies in how to define the labelled transition relation which describe the semantics of a language. Let us consider how we could deal with two typical sequential programming language constructs in this approach: a. Assignment statement The semantics of the assignment statement is defined by the following axiom: <x:=e,s> 6><skip,s[v/xl> where v--[e] s (hell the value of the expression e in the state s.) This s is transition can be interpreted as saying that the execution of the statement x:=e in the state s results in a new configuration where the new statement is skip and the new state is the same as before except at x where it takes the value of e.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages321 Page
-
File Size-