This paper describes a seven-pass compiler for Per Brlnch Hansen's Concurrent Pascal [1,2] programing language. Concurrent Pascal is an abstract programming language for conputer operating systems. The language extends sequential Pascal [7] with the process, nonitor, and class concepts for structured concurrent programing. A ironitor is a shared data structure together with a well-definec set of operations that are the only operations possible on the data structure. Concurrent Pascal's runtime system enforces mutually exclusive access to a nonitor by competing concurrent processes. A class gives a single process controlled access to a private data structure by neans of a well-defined set of operations.
The Concurrent Pascal compiler has been running on a DEC PDP-11/45 computer at Caltech since January 1975. It requires 16,500 16-bit words of storage and compiles source text at the rate of 240 characters per second (about 9-10 lines per second). It generates code for an ideal virtual nachlne that is simulated by the real machine. The conpiler is written in sequential Pascal and is easily transported to other machines.
As nany machine-depencent aspects of the compiler as possible are nade into changeable constant definitions. The conpiler's semantic analysis passes are isolated fron the virtual machine by two code assenbly passes. So not only can different real machines interpret the virtual machine, but the code assembly passes can be changed to view different virtual machines. This permits redesign of the final instruction set without Significantly affecting the compiler.
In the chapters to follow, basic terms are defined, the pass breakdown is described, each pass is described, the virtual machine is defined, and the implenentation is discussed. Many of the compilation techniques used here are well-known, but, taken as a whole, this compiler is an engineering product that may serve as a prototype for industrial compiler writers. For this reason, the description of the conpiler is made as self-contained as possible.