encyclopegia.org

B (programming language)

B is a programming language developed at Bell Labs circa 1969 by Ken Thompson and Dennis Ritchie. B was designed for recursive, non-numeric, machine-independent applications, such as system and language software. It was a typeless language, with the only data type being the underlying machine's natural memory word format, whatever that might be. Depending on the context, the word was treated either as an integer or a memory address. As machines with ASCII processing became common, notably the DEC PDP-11 that arrived at Bell Labs, support for character data stuffed in memory words became important. The typeless nature of the language was seen as a disadvantage, which led Thompson and Ritchie to develop an expanded version of the language supporting new internal and user-defined types, which became the ubiquitous C programming language.

B is a programming language developed at Bell Labs circa 1969 by Ken Thompson and Dennis Ritchie. B was designed for recursive, non-numeric, machine-independent applications, such as system and language software. It was a typeless language, with the only data type being the underlying machine's natural memory word format, whatever that might be. Depending on the context, the word was treated either as an integer or a memory address. As machines with ASCII processing became common, notably the DEC PDP-11 that arrived at Bell Labs, support for character data stuffed in memory words became important. The typeless nature of the language was seen as a disadvantage, which led Thompson and Ritchie to develop an expanded version of the language supporting new internal and user-defined types, which became the ubiquitous C programming language. Thompson added "two-address assignment operators" using x =+ y syntax to add y to x (in C the operator is written += ). This syntax came from Douglas McIlroy's implementation of TMG, in which B's compiler was first implemented (and it came to TMG from ALGOL 68's x +:= y syntax). Thompson went further by inventing the increment and decrement operators ( ++ and -- ). Their prefix or postfix position determines whether the value is taken before or after alteration of the operand. This innovation was not in the earliest versions of B. According to Dennis Ritchie, people often assumed that they were created for the auto-increment and auto-decrement address modes of the DEC PDP-11, but this is historically impossible as the machine didn't exist when B was first developed. B is typeless, or more precisely has one data type: the computer word. Most operators (e.g. + , - , * , / ) treated this as an integer, but others treated it as a memory address to be dereferenced. In many other ways it looked a lot like an early version of C. It included a generalized for loop as later appeared in C, which Thompson adapted from earlier work by Stephen Johnson. There are a few library functions, including some that vaguely resemble functions from the standard I/O library in C. In Thompson's words: "B and the old old C were very very similar languages except for all the types [in C]". Early implementations were for the DEC PDP-7 and PDP-11 minicomputers using early Unix, and Honeywell 36-bit mainframes running the operating system GCOS. The earliest PDP-7 implementations compiled to threaded code, and Ritchie wrote a compiler using TMG which produced machine code. In 1970 a PDP-11 was acquired and threaded code was used for the port; an assembler, , and the B language itself were written in B to bootstrap the computer. An early version of yacc was produced with this PDP-11 configuration. Ritchie took over maintenance during this period. The typeless nature of B made sense on the Honeywell, PDP-7 and many older computers, but was a problem on the PDP-11 because it was difficult to elegantly access the character data type that the PDP-11 and most modern computers fully support. Starting in 1971 Ritchie made changes to the language while converting its compiler to produce machine code, most notably adding data typing for variables. During 1971 and 1972 B evolved into "New B" (NB) and then C. B is almost extinct, having been superseded by the C language. However, it continues to see use on GCOS mainframes ( ) and on certain embedded systems ( ) for a variety of reasons: limited hardware in small systems, extensive libraries, tooling, licensing cost issues, and simply being good enough for the job. The highly influential AberMUD was originally written in B. /* The following function will print a non-negative number, n, to the base b, where 2 /* The following program will calculate the constant e-2 to about 4000 decimal digits, and print it 50 characters to the line in groups of 5 characters. The method is simple output conver- sion of the expansion 1/2! + 1/3! + ... = .111... where the bases of the digits are 2, 3, 4, ... */ main() { extrn putchar, n, v; auto i, c, col, a; i = col = 0; while(i

References

No reference rows published for this article.

Cite this article

MLA

"B (programming language)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/b-programming-language. Accessed 24 November 2026.

Chicago

"B (programming language)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/b-programming-language.

APA

encyclopegia.org. (2026). B (programming language). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/b-programming-language

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Ada (programming language)

enwiki · references available

APL (programming language)

enwiki · references available

C (programming language)

enwiki · references available

Erlang (programming language)

enwiki · references available

JavaScript

enwiki · references available

Forth (programming language)

enwiki · references available

Acupuncture

enwiki · references available

Accumulator (computing)

enwiki · references available

Burkina Faso

enwiki · references available

Boeing 767

enwiki · references available

Body mass index

enwiki · references available

Cygwin

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1377842378 · 0.5 · snapshot enwiki-001377842378

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.