C


C is a small, Algol-family procedural language designed to support the implementation of the Unix operating system. Dennis Ritchie developed C in the early 1970's from a language called B (itself developed by Ken Thompson from BCPL).

The history of C is described by Ritchie in a paper from the HoPL II (History of Programming Languages II) conference which you can read here.

There are three major versions of C.

  1. [K&R C] The original language was developed between 1971 and 1973. This version is usually called K&R C after the authors of the definitive book on the language (Brian Kernighan and Dennis Ritchie) which was published in 1978.

  2. [C90] By the early 1980's, usage was widespread enough to merit formal standardisation. ANSI established the X3J11 committee in 1983, and the first standard X3.159-1989 was produced in 1989. The following year ISO ratified the standard as ISO/IEC 9899:1990. This version of the language is referred to variously as ANSI-C, C89 or C90 (our preferred name). An amendment was published in 1995 (Normative Amendment 1) which added support for international character sets. This amendment did not change the grammar, so we can ignore it here.

    We have two grammars available

    1. C90: second edition of K&R

      This is the grammar from Appendix A (pages 234--239) of KR2 ('The C Programming Language' second edition, Brian W. Kernighan and Dennis M. Ritchie; Prentice Hall; 1988 ISBN 0-13-110362).

      NB: The preprocessor is only approximately described in this grammar. In addition, there are errors in the preprocessor part of the grammar that we have corrected. See the comments in the .raw file for details.

      We recommend that the ansi_c_89 grammar (below) is used instead of this one.

      ansi_c_kr2.raw raw grammar from the typeset document
      ansi_c_kr2.gex grammar rules extracted using gramex V1.2

    2. C90: ANSI X3.159-1989

      This is the grammar from Annex B of the 1989 ANSI standard. It contains a full description of the preprocessor's syntax. We recommend that this grammar is used in preference to the K&R version (above).

      ansi_c_89.raw raw grammar from the typeset document
      ansi_c_89.gex grammar rules extracted using gramex V1.2 ll1.tbl lr0.tbl slr1.tbl lr1.tbl lalr1.tbl generated by gtb V2.6

  3. [C99] A major revision of the standard was published by ISO in 1999 as ISO 9899:1999, which subsequently became an ANSI standard in 2000. This revision is usually called C99. Take up of C99 has been slow, perhaps because it is incompatible with C++ whereas C90 is (almost) a subset of C++.


  • Contact us
  • Location map
  • Terms & conditions