12.1 A Compiler as a Software Project

A compiler is a special type of large software project. Allen (1990) lists the following as phases of the compiler construction life cycle:

1. Specification Often, a compiler is designed from a language document. This document may change or may need to be changed as the project continues. Specifications of compile speed, produced code and space limitations must be considered.

2. Design Compilers may be bootstrapped from other compilers. They may use tools for many of their parts. Portability and retargetability need to be considered early in the design phase. Good interfaces are important. Key utilities such as node generators, tree-walk routines, printing utilities, etc. must be identified. These include the various tables to be used: symbol tables, type tables, label tables, most of which need to be accessed dynamically and read more than they are written to. Various intermediate representations may be designed.

3. Groundwork It is very important to build the right tools first, before building the compiler. Such tools may include a simulator if the hardware is new, since the compiler may need to be debugged before the hardware is ready. Other tools and utilities should identify and record clearly the various versions, centralize debugging and memory allocation, and identify the various compiler switches and listing utilities. Validation and testing programs should be assembled. A profiler should be created and used throughout the compiler creation life cycle. One should be prepared to measure everything.

4. Implementation Steps 1 to 3 will lay out the compiler to be implemented. Coding standards will ease the assembling of modules. Debugging must be built in. A centralized error processor saves work in the long run.

5. Maintenance A large programming language compiler may be maintained for years and involve more person-hours than any of the other phases. Again, good tools, clear interfaces and good built-in debugger facilities, as well as coordinated bug reports, can aid this process.

6. Improvement It is important to recognize early in the design process that improvements will be necessary. Techniques include a flexible framework that eases extensions.

Send questions and comments to: Karen Lemone