B&o e8 3rd generation review

This article is about a programming language developed at Bell Labs. For "b" language of Meertens and Pemberton, see ABC [programming language]. For other uses, see B [disambiguation].

BDesigned byKen ThompsonDeveloperKen Thompson, Dennis RitchieFirst appeared1969; 54 years agoTyping disciplinetypeless [everything is a word]Filename extensions.bInfluenced byBCPL, PL/I, TMGInfluencedC

B is a programming language developed at Bell Labs circa 1969 by Ken Thompson and Dennis Ritchie.

B was derived from BCPL, and its name may possibly 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. 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, 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 C programming language.

History[edit]

BCPL semantics with a lot of SMALGOL syntax — Ken Thompson,

Circa 1969, 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. The assignment operator := reverted to the = of Rutishauser's Superplan, and the equality operator = was replaced by ==.

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

/ 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 conversion 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

Chủ Đề