Portable C Compiler

From Wikipedia, the free encyclopedia

The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) was an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in mid-1970s [1]. It was very influential at its time as one of the first compilers that could easily be adapted to output code for different computer architectures. In the beginning of the 1980s, the majority of C compilers were based on pcc [2], and the compiler had a long life span, shipping with 4.3BSD-Reno in 1990 until the GNU C compiler replaced it in 4.4BSD.

The keys to the success of pcc were its portability and diagnostic capabilities:

  • The compiler was designed so that only a few of its source files were machine-dependent.
  • It was robust to syntax errors and refused to compile invalid programs.
  • It isolated machine dependent code to be rewritten manually in the target's native assembler.
  • Its first pass was self-optimising.

These features were new in the days pcc was written. The first C compiler was written by Dennis Ritchie using a recursive-descent method, was closely tied to the PDP-11, and relied on a post-pass machine-specific optimizer to improve its code. In contrast, Johnson's multi-pass compiler counted memory accesses in the code sequences for each expression, generating the code with the fewest memory accesses.

In turn, pcc borrowed some ideas from a portable C compiler by Alan Snyder, who wrote it in 1973 for his Master's Thesis at M.I.T. [3][4].


[edit] References

  • Johnson, S.C. (1978). "A portable compiler: theory and practice". Proceedings of the 5th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. Tucson, Arizona. pp. 97-104. Online reprint at ACM.
  • Ritchie, Dennis M. (1993). "The development of the C language". The second ACM SIGPLAN conference on History of programming languages. Cambridge, Massachusetts. pp. 201-208. Online reprint.
  • Snyder, A. (1975). "A Portable Compiler for the Language C". Master’s Thesis. M.I.T., Cambridge, Mass. Online reprint.
  • Johnson, S.C. (1981). "A Tour Through the Portable C Compiler". Unix Programmer's Manual, 7th edition, Volume 2, ISBN 0-03-061743-X. Online version.

[edit] External Links

  • The source code of an early version is here and here.