LLMpediaThe first transparent, open encyclopedia generated by LLMs

B (programming language)

Generated by DeepSeek V3.2
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Expansion Funnel Raw 37 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted37
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
B (programming language)
ParadigmProcedural programming
DesignerKen Thompson, Dennis Ritchie
DeveloperBell Labs
Released0 1969
InfluencedC (programming language)

B (programming language). B is a procedural programming language developed at Bell Labs in the late 1960s, primarily by Ken Thompson with contributions from Dennis Ritchie. It was derived from the earlier BCPL language and was instrumental in creating the original Unix operating system on the PDP-7 and PDP-11 computers. Although short-lived, its design directly influenced the creation of the immensely successful C (programming language), establishing a foundational lineage for modern systems programming.

History and development

The development of B began in 1969 at Bell Labs, where Ken Thompson sought a language to port the nascent Unix operating system from the GE-645 to the smaller PDP-7. Thompson, influenced by his experience with Martin Richards's BCPL, created B as a simplified and syntactically altered version. Dennis Ritchie soon joined the effort, contributing to the language's evolution as it was moved to the PDP-11. A key limitation was B's typeless nature, which became problematic for the new machine's byte-addressable memory, prompting Ritchie to begin work on its successor. This period of intense collaboration within the Computing Science Research Center at Bell Labs was crucial for the transition from B to the C (programming language).

Design and features

B was designed as a typeless language, treating all data as fixed-length words or machine words, an approach inherited from BCPL. This model was efficient on the word-addressable PDP-7 but proved awkward on the newer PDP-11, which used byte-addressable memory. The language provided basic control flow constructs like `if`, `while`, and `for`, along with support for recursion. Memory manipulation was done through explicit operators, a precursor to C's pointer arithmetic. Its compiler produced interpretive threaded code, which offered portability but at the cost of execution speed compared to direct machine code.

Syntax and examples

The syntax of B was notably sparse, omitting data type declarations and using the `&` and `*` operators for the address of a variable and for indirection, respectively. A canonical "Hello, World" program in B would appear as: ``` main() { putstr("Hello, world!*n"); } ``` Function definitions did not specify return types, and variables were automatically declared upon first use, typically within functions. The language used braces `{ }` to delimit blocks, a convention carried from BCPL into C (programming language). Libraries for input/output were minimal, often consisting of simple routines like `getchar` and `putchar` for interaction with the Unix environment.

Influence and legacy

The primary and monumental legacy of B is its direct role as the precursor to the C (programming language). The difficulties encountered when adapting B for the PDP-11 led Dennis Ritchie to add data types, creating what he initially called "New B" and then C (programming language). This new language retained B's core syntax and operators while introducing a powerful type system. Consequently, B's influence permeates the entire Unix ecosystem, the POSIX standard, and modern systems programming. While B itself faded from use by the mid-1970s, its conceptual DNA is evident in the syntax of countless successors, including C++, Objective-C, and Java (programming language).

Implementations and variants

The original and primary implementation was the B compiler written by Ken Thompson for the PDP-7 and later the PDP-11 at Bell Labs. As the language evolved into C (programming language), pure B implementations became obsolete. However, a few variant and interpretive systems emerged. In the 1970s, Honeywell maintained a version for its GCOS operating system. The language B also inspired early work on Ratfor, a Fortran preprocessor. Today, the only surviving "variant" is essentially the C (programming language), though historical implementations can be found in archives of early Unix distributions from Bell Labs.

Category:Procedural programming languages Category:Bell Labs Category:Programming languages created in 1969