Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
B (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== History == {{rquote|quote=BCPL semantics with a lot of SMALGOL syntax|author=Ken Thompson|source=<ref name=Ars>{{cite web |last1=Jensen |first1=Richard |title="A damn stupid thing to do"βthe origins of C |url=https://arstechnica.com/features/2020/12/a-damn-stupid-thing-to-do-the-origins-of-c/ |website=Ars Technica |access-date=2022-03-28 |language=en-us |date=9 December 2020}}</ref>}} Circa 1969, [[Ken Thompson (computer programmer)|Ken Thompson]]<ref name=chist /> and later Dennis Ritchie<ref name=bur /> 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).<ref name=chist /> Much of the typical [[ALGOL]]-like syntax of BCPL was rather heavily changed in this process. The assignment operator <code>:=</code> reverted to the <code>=</code> of [[Heinz Rutishauser|Rutishauser]]'s [[Superplan]], and the equality operator <code>=</code> was replaced by <code>==</code>. Thompson added "two-address assignment operators" using <code>x =+ y</code> syntax to add y to x (in C the operator is written <code>+=</code>). This syntax came from [[Douglas McIlroy]]'s implementation of [[TMG (language)|TMG]], in which B's compiler was first implemented (and it came to TMG from [[ALGOL 68]]'s <code>x +:= y</code> syntax).<ref name=chist /><ref>{{cite web |author=Michael S. Mahoney |author-link=Michael Sean Mahoney |url=https://www.princeton.edu/~hos/mike/transcripts/mcilroy.htm |title=Interview with M.D. McIlroy |location=Murray Hill |date=18 August 1989|website=Princeton.edu}}</ref> Thompson went further by inventing the increment and decrement operators (<code>++</code> and <code>--</code>). 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.<ref name=chist /> The semicolon version of the [[for loop]] was borrowed by Ken Thompson from the work of [[Stephen C. Johnson|Stephen Johnson]].<ref name="ken">{{cite web|title=VCF East 2019 -- Brian Kernighan interviews Ken Thompson| author=Ken Thompson| website=[[YouTube]]| url=https://www.youtube.com/watch?v=EY6q5dv_B-o&t=2330 | archive-url=https://ghostarchive.org/varchive/youtube/20211123/EY6q5dv_B-o| archive-date=2021-11-23 | url-status=live|quote="I saw Johnson's semicolon version of the for loop and I put that in [B], I stole it." | access-date=2020-11-16}}{{cbignore}}</ref> B is typeless, or more precisely has one data type: the computer word. Most operators (e.g. <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>) treated this as an integer, but others treated it as a memory address to be [[reference (computer science)|dereferenced]]. In many other ways it looked a lot like an early version of C. There are a few library functions, including some that vaguely resemble functions from the [[stdio.h|standard I/O library]] in C.<ref name=bur /> 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 /> B is almost extinct, having been superseded by the [[C (programming language)|C language]].<ref name=plb /> However, it continues to see use on [[General Comprehensive Operating System|GCOS]] mainframes ({{as of|2014|lc=y}})<ref name="uwtools">{{cite web | title = Thinkage UW Tools Package | access-date = 26 March 2014 | publisher = Thinkage, Ltd. | url = http://www.thinkage.ca/english/gcos/product-uwtools.shtml }}</ref> and on certain [[embedded systems]] ({{as of|2000|lc=y}}) for a variety of reasons: limited hardware in small systems, extensive libraries, tooling, licensing cost issues, and simply being good enough for the job.<ref name=plb>{{cite web | last = Johnson and Kernighan | author-link = Stephen C. Johnson | title = THE PROGRAMMING LANGUAGE B | access-date = 21 March 2014 | publisher = Bell Laboratories | url = https://www.bell-labs.com/usr/dmr/www/bintro.html | archive-url = https://web.archive.org/web/20150611114355/https://www.bell-labs.com/usr/dmr/www/bintro.html | archive-date = 11 June 2015 }}</ref> The highly influential [[AberMUD]] was originally written in B.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)