B (programming language): Difference between revisions

Content deleted Content added
Kirdow (talk | contribs)
Undid vandalism 1291347757 by Aboualiaa (talk)
Added another major implementation, and removed two out-dated, no longer maintained implementations.
 
(4 intermediate revisions by 4 users not shown)
Line 18:
| influenced_by = [[BCPL]], [[PL/I]], [[TMG (language)|TMG]]
| influenced = [[C (programming language)|C]]
| implementations = [https://github.com/wgibbs-rs/blang BLang LLVM-based B Compiler], [https://github.com/tsoding/b B by Alexey Kutepov (incomplete)], [https://github.com/Spydr06/BCause BCause, A Modern B Compiler]
| operating_system =
| license =
Line 41 ⟶ 42:
}}</ref> 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]].
 
== History ==
Line 55 ⟶ 56:
In Thompson's words: "B and the old old C were very very similar languages except for all the types [in C]".<ref name="ken"/>
 
Early implementations were for the DEC [[PDP-7]] and [[PDP-11]] minicomputers using early [[Unix]], and [[Honeywell]] {{nowrap|[[GE-600 series|GE 645]]}}<ref name="Evolution">{{cite journal |first=Dennis M. |last=Ritchie |title=The Evolution of the Unix Time-sharing System |url=https://www.bell-labs.com/usr/dmr/www/hist.html |archive-url=https://web.archive.org/web/20150611114353/https://www.bell-labs.com/usr/dmr/www/hist.html |archive-date=11 June 2015 |journal=AT&T Bell Laboratories Technical Journal |volume=63 |number=6 Part 2 |year=1984 |pages=1577–1593|doi=10.1002/j.1538-7305.1984.tb00054.x |url-access=subscription }}</ref> 36-bit mainframes running the operating system [[General Comprehensive Operating System|GCOS]]. The earliest PDP-7 implementations compiled to [[threaded code]], and Ritchie wrote a compiler using [[TMG (language)|TMG]] which produced machine code.<ref>{{cite web |url=http://www.multicians.org/tmg.html |title=TMG |publisher=multicians.org}}</ref><ref>{{cite web |url=https://www.bell-labs.com/usr/dmr/www/chist.html |archive-url=https://web.archive.org/web/20150611114355/https://www.bell-labs.com/usr/dmr/www/chist.html |archive-date=11 June 2015 |title=The Development of the C Language |first=Dennis M. |last=Ritchie |author-link=Dennis Ritchie |publisher=Bell Labs/Lucent Technologies}}</ref><ref name="reader">{{cite tech report |first1=M. D. |last1=McIlroy |author-link1=Douglas McIlroy |year=1987 |url=http://www.cs.dartmouth.edu/~doug/reader.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://www.cs.dartmouth.edu/~doug/reader.pdf |archive-date=2022-10-09 |url-status=live |title=A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986 |series=CSTR |number=139 |institution=Bell Labs}}</ref> In 1970 a PDP-11 was acquired and threaded code was used for the port; an assembler, {{samp|[[dc (Unix)|dc]]}}, and the B language itself were written in B to [[Bootstrapping|bootstrap]] the computer. An early version of [[yacc]] was produced with this PDP-11 configuration. Ritchie took over maintenance during this period.<ref name=chist />{{r|reader}}
 
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.<ref name=chist />