skip to main content
The design of a high-level coroutine implementation for the production of quality software
Publisher:
  • University of Maryland at College Park
  • College Park, MD
  • United States
Order Number:AAI8116453
Pages:
268
Bibliometrics
Skip Abstract Section
Abstract

The concept of coroutines is virtually unknown in the commercial programming world in spite of the fact that they have been used since the early sixties. Even people with a general academic background in computer science typically receive only a passing exposure to coroutines in some early course. Part of the reason for this lack of knowledge is the fact that no coroutine mechanism is available in any of the popular high-level languages. In just the same way that Fortran and Cobol programmers find recursion an alien concept, so most programmers do with coroutines.

Even those few high-level languages that support coroutines do so in a rather low-level way. The problem is the same one that has been imputed to unrestricted GOTOs; these implementations offer the possibility of undisciplined control flow and impose the burden of managing that flow on the programmer. As a result, coroutines have remained an awkward, unmanageable mechanism even in those languages in which they have been available.

This dissertation attempts a new approach to coroutines. In this approach, the overall activity of a coroutine is viewed as being substantially the same as a normal main program, and the resumption of a coroutine is viewed as being substantially the same as a subroutine call. This view is used to direct the design of an implementation of coroutines in a simple high-level language. The implementation is more self-disciplined, providing a programming tool with greater intellectual manageability. It is our position that if coroutines were so implemented in high-level languages, they would become less of an academic curiosity and more of a tool for the design of production programs.

In addition to informal examples in our simple language, we will provide a firm mathematical basis for our implementation by the use of two formal definitions. The first of these will be an implicit definition of the meaning of coroutines using the functional verification techniques of Mills. The second is a constructive definition of an interpreter for our language using the Hierarchical Graph Language (HGL) modeling technique of Basili. Both full coroutines and semicoroutines are investigated using these methods.

The structure of the dissertation is as follows. Chapter I provides introductory material, which includes a description, a discussion of applications, and a history of coroutines. Chapter II discusses the syntax and semantics of an implementation of semicoroutines and full coroutines in Simpl at an informal level. Chapter III applies functional verification to provide the implicit definition of semicoroutines and, to a lesser extent, full coroutines. It also discusses the use of functional verification for the formal certification of programs containing coroutines. Chapter IV provides the formal HGL model of semicoroutines and an informal discussion of the implementation of full coroutines. Chapter V looks at two important language features which interact with coroutines and discusses the conflicts which result. Four appendices are provided to discuss design decisions, extensions to functional verification, the HGL definition, and the HGL model in greater depth.

Contributors
  • University of Maryland, College Park

Recommendations