Designed by | Ken Thompson |
---|---|
Developer | Ken Thompson, Dennis Ritchie |
First appeared | 1969 |
Typing discipline | typeless (everything is a word) |
Filename extensions | .b |
Influenced by | |
BCPL, PL/I | |
Influenced | |
C |
B is a programming language developed at Bell Labs circa 1969. It is the work of Ken Thompson with Dennis Ritchie.
B was derived from BCPL, and its name may be a contraction of BCPL. Thompson's coworker Dennis Ritchie speculated that the name might be based on Bon, an earlier, but unrelated, programming language that Thompson designed for use on Multics.
B was designed for recursive, non-numeric, machine independent applications, such as system and language software.
Initially Ken Thompson and later Dennis Ritchie developed B basing it mainly on the BCPL language Thompson used in the Multics project. B was essentially the BCPL system stripped of any component Thompson felt he could do without in order to make it fit within the memory capacity of the minicomputers of the time. The BCPL to B transition also included changes made to suit Thompson's preferences (mostly along the lines of reducing the number of non-whitespace characters in a typical program). Much of the typical ALGOL-like syntax of BCPL was rather heavily changed in this process, such as the := and = operators which were replaced with = for assignment and == for equality test. (The & and | of BCPL was later changed to && and || in the transition to what is now known as C.) The assignment operator went back to "=" of Rutishauser's programming language Superplan, which had influenced ALGOL 58, that added a colon.
Thompson invented arithmetic assignment operators for B, using x =+ y
to add y to x (in the C programming language the operator is spelled as +=
). B also introduced the increment and decrement operators (++ and --); Their prefix or postfix position determines whether the value is taken prior or post alteration of the operand. These innovations were not in the earliest versions of B. Some guess that they were created for the auto-increment and auto-decrement address modes of the DEC PDP-11. This is historically impossible as there was no PDP-11 at the time that B was developed.