HOME

TheInfoList



OR:

BCPL ("Basic Combined Programming Language") is a procedural, imperative, and
structured Structuring, also known as smurfing in banking jargon, is the practice of executing financial transactions such as making bank deposits in a specific pattern, calculated to avoid triggering financial institutions to file reports required by law ...
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
. Originally intended for writing
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s for other languages, BCPL is no longer in common use. However, its influence is still felt because a stripped down and syntactically changed version of BCPL, called B, was the language on which the
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well a ...
was based. BCPL introduced several features of many modern programming languages, including using curly braces to delimit code blocks. BCPL was first implemented by
Martin Richards Martin Richards may refer to: * Martin Richards (computer scientist) (born 1940), British computer scientist * Martin Richards (police officer) (born 1959), British chief constable * Martin Richards (producer) Martin Richards (born Morton Richa ...
of the
University of Cambridge , mottoeng = Literal: From here, light and sacred draughts. Non literal: From this place, we gain enlightenment and precious knowledge. , established = , other_name = The Chancellor, Masters and Schola ...
in 1967.


Design

BCPL was designed so that small and simple compilers could be written for it; reputedly some compilers could be run in 16
kilobyte The kilobyte is a multiple of the unit byte for digital information. The International System of Units (SI) defines the prefix '' kilo'' as 1000 (103); per this definition, one kilobyte is 1000 bytes.International Standard IEC 80000-13 Quant ...
s. Further, the original compiler, itself written in BCPL, was easily portable. BCPL was thus a popular choice for
bootstrapping In general, bootstrapping usually refers to a self-starting process that is supposed to continue or grow without external input. Etymology Tall boots may have a tab, loop or handle at the top known as a bootstrap, allowing one to use fingers ...
a system. A major reason for the compiler's portability lay in its structure. It was split into two parts: the front end parsed the source and generated O-code, an
intermediate language An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A " ...
. The back end took the O-code and translated it into the machine code for the target machine. Only of the compiler's code needed to be rewritten to support a new machine, a task that usually took between 2 and 5 person-months. This approach became common practice later (e.g.
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Frenc ...
,
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
). The language is unusual in having only one
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
: a
word A word is a basic element of language that carries an objective or practical meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no conse ...
, a fixed number of bits, usually chosen to align with the architecture's machine word and of adequate capacity to represent any valid storage address. For many machines of the time, this data type was a 16-bit word. This choice later proved to be a significant problem when BCPL was used on machines in which the smallest addressable item was not a word but a
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable uni ...
or on machines with larger word sizes such as 32-bit or 64-bit. The interpretation of any value was determined by the operators used to process the values. (For example, + added two values together, treating them as
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
s; ! indirected through a value, effectively treating it as a pointer.) In order for this to work, the implementation provided no
type checking In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
. The mismatch between BCPL's word orientation and
byte-oriented Byte-oriented framing protocol is "a communications protocol in which full bytes are used as control codes. Also known as character-oriented protocol." For example UART communication is byte-oriented. The term "character-oriented" is deprecated, ...
hardware was addressed in several ways. One was by providing standard library routines for packing and unpacking words into byte strings. Later, two language features were added: the bit-field selection operator and the infix byte indirection operator (denoted by %). BCPL handles bindings spanning separate
compilation unit In C and C++ programming language terminology, a translation unit (or more casually a compilation unit) is the ultimate input to a C or C++ compiler from which an object file is generated. A translation unit roughly consists of a source file a ...
s in a unique way. There are no user-declarable global variables; instead, there is a global vector, similar to "blank common" in Fortran. All data shared between different compilation units comprises scalars and pointers to vectors stored in a pre-arranged place in the global vector. Thus, the header files (files included during compilation using the "GET" directive) become the primary means of synchronizing global data between compilation units, containing "GLOBAL" directives that present lists of symbolic names, each paired with a number that associates the name with the corresponding numerically addressed word in the global vector. As well as variables, the global vector contains bindings for external procedures. This makes dynamic loading of compilation units very simple to achieve. Instead of relying on the link loader of the underlying implementation, effectively, BCPL gives the programmer control of the linking process. The global vector also made it very simple to replace or augment standard library routines. A program could save the pointer from the global vector to the original routine and replace it with a pointer to an alternative version. The alternative might call the original as part of its processing. This could be used as a quick ''ad hoc'' debugging aid. BCPL was the first
brace programming language This is a list of notable programming languages, grouped by type. There is no overarching classification scheme for programming languages. Thus, in many cases, a language is listed under multiple headings (in this regard, see " Multiparadigm lan ...
and the braces survived the syntactical changes and have become a common means of denoting program source code statements. In practice, on limited keyboards of the day, source programs often used the sequences $( and $) in place of the symbols . The single-line //
comment Comment may refer to: * Comment (linguistics) or rheme, that which is said about the topic (theme) of a sentence * Bernard Comment (born 1960), Swiss writer and publisher Computing * Comment (computer programming), explanatory text or informat ...
s of BCPL, which were not adopted by C, reappeared in
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
and later in C99. The book ''BCPL: The language and its compiler'' describes the philosophy of BCPL as follows:


History

BCPL was first implemented by
Martin Richards Martin Richards may refer to: * Martin Richards (computer scientist) (born 1940), British computer scientist * Martin Richards (police officer) (born 1959), British chief constable * Martin Richards (producer) Martin Richards (born Morton Richa ...
of the
University of Cambridge , mottoeng = Literal: From here, light and sacred draughts. Non literal: From this place, we gain enlightenment and precious knowledge. , established = , other_name = The Chancellor, Masters and Schola ...
in 1967. BCPL was a response to difficulties with its predecessor, Cambridge Programming Language, later renamed
Combined Programming Language Combined may refer to: * Alpine combined (skiing), the combination of slalom and downhill skiing as a single event ** Super combined (skiing) * Nordic combined (skiing), the combination of cross country skiing and ski jumping as a single event * T ...
(CPL), which was designed during the early 1960s. Richards created BCPL by "removing those features of the full language which make compilation difficult". The first compiler implementation, for the
IBM 7094 The IBM 7090 is a second-generation transistorized version of the earlier IBM 709 vacuum tube mainframe computer that was designed for "large-scale scientific and technological applications". The 7090 is the fourth member of the IBM 700/7000 s ...
under
Compatible Time-Sharing System The Compatible Time-Sharing System (CTSS) was the first general purpose time-sharing operating system. Compatible Time Sharing referred to time sharing which was compatible with batch processing; it could offer both time sharing and batch proces ...
, was written while Richards was visiting Project MAC at the
Massachusetts Institute of Technology The Massachusetts Institute of Technology (MIT) is a private land-grant research university in Cambridge, Massachusetts. Established in 1861, MIT has played a key role in the development of modern technology and science, and is one of th ...
in the spring of 1967. The language was first described in a paper presented to the 1969 Spring
Joint Computer Conference The Joint Computer Conferences were a series of computer conferences in the United States held under various names between 1951 and 1987. The conferences were the venue for presentations and papers representing "cumulative work in the omputerfield ...
. BCPL has been rumored to have originally stood for "Bootstrap Cambridge Programming Language", but CPL was never created since development stopped at BCPL, and the acronym was later reinterpreted for the BCPL book. BCPL is the language in which the original
"Hello, World!" program A "Hello, World!" program is generally a computer program that ignores any input and outputs or displays a message similar to "Hello, World!". A small piece of code in most general-purpose programming languages, this program is used to illustr ...
was written. The first MUD was also written in BCPL (''
MUD1 ''Multi-User Dungeon'', or ''MUD'' (referred to as ''MUD1'', to distinguish it from its successor, ''MUD2'', and the MUD genre in general), is the first MUD. History MUD was created in 1978 by Roy Trubshaw and Richard Bartle at the Univ ...
''). Several
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s were written partially or wholly in BCPL (for example,
TRIPOS At the University of Cambridge, a Tripos (, plural 'Triposes') is any of the examinations that qualify an undergraduate for a bachelor's degree or the courses taken by a student to prepare for these. For example, an undergraduate studying mat ...
and the earliest versions of
AmigaDOS AmigaDOS is the disk operating system of the AmigaOS, which includes file systems, file and directory manipulation, the command-line interface, and file redirection. In AmigaOS 1.x, AmigaDOS is based on a TRIPOS port by MetaComCo, written in ...
). BCPL was also the initial language used in the seminal
Xerox PARC PARC (Palo Alto Research Center; formerly Xerox PARC) is a research and development company in Palo Alto, California. Founded in 1969 by Jacob E. "Jack" Goldman, chief scientist of Xerox Corporation, the company was originally a division of Xero ...
Alto The musical term alto, meaning "high" in Italian ( Latin: ''altus''), historically refers to the contrapuntal part higher than the tenor and its associated vocal range. In 4-part voice leading alto is the second-highest part, sung in choruse ...
project, the first modern
personal computer A personal computer (PC) is a multi-purpose microcomputer whose size, capabilities, and price make it feasible for individual use. Personal computers are intended to be operated directly by an end user, rather than by a computer expert or te ...
; among other projects, the Bravo document preparation system was written in BCPL. An early compiler, bootstrapped in 1969, by starting with a paper tape of the O-code of Richards's Atlas 2 compiler, targeted the
ICT 1900 series ICT 1900 was a family of mainframe computers released by International Computers and Tabulators (ICT) and later International Computers Limited (ICL) during the 1960s and 1970s. The 1900 series was notable for being one of the few non-American c ...
. The two machines had different word-lengths (48 vs 24 bits), different character encodings, and different packed string representations—and the successful bootstrapping increased confidence in the practicality of the method. By late 1970, implementations existed for the Honeywell 635 and Honeywell 645,
IBM 360 The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applica ...
,
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, espec ...
, TX-2, CDC 6400,
UNIVAC 1108 The UNIVAC 1100/2200 series is a series of compatible 36-bit computer systems, beginning with the UNIVAC 1107 in 1962, initially made by Sperry Rand. The series continues to be supported today by Unisys Corporation as the ClearPath Dorado Serie ...
,
PDP-9 The PDP-9, the fourth of the five 18-bit minicomputers produced by Digital Equipment Corporation, was introduced in 1966. A total of 445 PDP-9 systems were produced, of which 40 were the compact, low-cost PDP-9/L units.. History The 18-bit PDP ...
, KDF 9 and Atlas 2. In 1974 a dialect of BCPL was implemented at BBN without using the intermediate O-code. The initial implementation was a
cross-compiler A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a PC but generates code that runs on an Android smartphone is a cross ...
hosted on BBN's TENEX
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, espec ...
s, and directly targeted the
PDP-11 The PDP-11 is a series of 16-bit minicomputers sold by Digital Equipment Corporation (DEC) from 1970 into the 1990s, one of a set of products in the Programmed Data Processor (PDP) series. In total, around 600,000 PDP-11s of all models were sol ...
s used in BBN's implementation of the second generation
IMPs IMPS or Imps may refer to: * ''Imps*'', a comedy film released in 2009 * OMA Instant Messaging and Presence Service * Infinite Monkey Protocol Suite, an April Fools' Day RFC * The Oxford Imps, an improvisational comedy troupe * Insensitive muni ...
used in the
ARPANET The Advanced Research Projects Agency Network (ARPANET) was the first wide-area packet-switched network with distributed control and one of the first networks to implement the TCP/IP protocol suite. Both technologies became the technical fou ...
. There was also a version produced for the
BBC Micro The British Broadcasting Corporation Microcomputer System, or BBC Micro, is a series of microcomputers and associated peripherals designed and built by Acorn Computers in the 1980s for the BBC Computer Literacy Project. Designed with an emphas ...
in the mid-1980s, by Richards Computer Products, a company started by John Richards, the brother of Martin Richards. The BBC Domesday Project made use of the language. Versions of BCPL for the
Amstrad CPC The Amstrad CPC (short for ''Colour Personal Computer'') is a series of 8-bit home computers produced by Amstrad between 1984 and 1990. It was designed to compete in the mid-1980s home computer market dominated by the Commodore 64 and the Si ...
and
Amstrad PCW The Amstrad PCW series is a range of personal computers produced by British company Amstrad from 1985 to 1998, and also sold under licence in Europe as the "Joyce" by the German electronics company Schneider in the early years of the series' life. ...
computers were also released in 1986 by UK software house Arnor Ltd. MacBCPL was released for the Apple Macintosh in 1985 by Topexpress Ltd, of Kensington, England. Both the design and philosophy of BCPL strongly influenced B, which in turn influenced C. Programmers at the time debated whether an eventual successor to C would be called "D", the next letter in the alphabet, or "P", the next letter in the parent language name. The language most accepted as being C's successor is
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
(with ++ being C's
increment operator Increment or incremental may refer to: * Incrementalism, a theory (also used in politics as a synonym for gradualism) * Increment and decrement operators, the operators ++ and -- in computer programming * Incremental computing *Incremental backup, ...
),History of C++
Retrieved 12 December 2017 although meanwhile, a D programming language also exists. In 1979, implementations of BCPL existed for at least 25 architectures; the language gradually fell out of favour as C became popular on non-Unix systems. Martin Richards maintains a modern version of BCPL on his website, last updated in 2018. This can be set up to run on various systems including Linux, FreeBSD, and Mac OS X. The latest distribution includes graphics and sound libraries, and there is a comprehensive manual. He continues to program in it, including for his research on musical automated score following. A common informal
MIME type A media type (also known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication o ...
for BCPL is .


Examples

If these programs are run using Richards' current version of Cintsys (December 2018), LIBHDR, START and WRITEF must be changed to lower case to avoid errors. Print factorials:
GET "LIBHDR"

LET START() = VALOF $(
	FOR I = 1 TO 5 DO
		WRITEF("%N! = %I4*N", I, FACT(I))
	RESULTIS 0
$)

AND FACT(N) = N = 0 -> 1, N * FACT(N - 1)
Count solutions to the N queens problem:
GET "LIBHDR"

GLOBAL $(
	COUNT: 200
	ALL: 201
$)

LET TRY(LD, ROW, RD) BE
	TEST ROW = ALL THEN
		COUNT := COUNT + 1
	ELSE $(
		LET POSS = ALL & ~(LD ,  ROW ,  RD)
		UNTIL POSS = 0 DO $(
			LET P = POSS & -POSS
			POSS := POSS - P
			TRY(LD + P << 1, ROW + P, RD + P >> 1)
		$)
	$)

LET START() = VALOF $(
	ALL := 1
	FOR I = 1 TO 12 DO $(
		COUNT := 0
		TRY(0, 0, 0)
		WRITEF("%I2-QUEENS PROBLEM HAS %I5 SOLUTIONS*N", I, COUNT)
		ALL := 2 * ALL + 1
	$)
	RESULTIS 0
$)


References


Further reading

* Martin Richards,
The BCPL Reference Manual
' (Memorandum M-352, Project MAC, Cambridge, MA, USA, July, 1967) * Martin Richards, ''BCPL - a tool for compiler writing and systems programming'' (Proceedings of the Spring Joint Computer Conference, Vol 34, pp 557–566, 1969) * Martin Richards, Arthur Evans, Robert F. Mabee,
The BCPL Reference Manual
' (MAC TR-141, Project MAC, Cambridge, MA, USA, 1974) * Martin Richards, Colin Whitby-Strevens, ''BCPL, the language and its compiler'' (Cambridge University Press, 1980)


External links


Martin Richards' BCPL distribution


by Dennis M. Ritchie
BCPL entry
in the
Jargon File The Jargon File is a glossary and usage dictionary of slang used by computer programmers. The original Jargon File was a collection of terms from technical cultures such as the MIT AI Lab, the Stanford AI Lab (SAIL) and others of the old ARPANET ...
* Nordier & Associates' x86br>port

ArnorBCPL manual
* How BCPL evolved from CPL, Martin Richard


Ritchie's ''The Development of the C Language''
has commentary about BCPL's influence on C
The BCPL Cintsys and Cintpos User Guide
{{DEFAULTSORT:Bcpl History of computing in the United Kingdom Procedural programming languages Programming languages created in 1967 Structured programming languages Systems programming languages University of Cambridge Computer Laboratory