BCPL

BCPL
Paradigmprocedural, imperative, structured
Designed byMartin Richards
First appeared1967; 58 years ago (1967)[1]
Typing disciplinetypeless (everything is a word)
Influenced by
CPL
Influenced
B, C, Go[2]

BCPL ("Basic Combined Programming Language") is a procedural, imperative, and structured programming language. Originally intended for writing compilers 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 was based. BCPL introduced several features of many modern programming languages, including using curly braces to delimit code blocks.[3] BCPL was first implemented by Martin Richards of the University of Cambridge in 1967.[1]

Design

BCPL was designed so that small and simple compilers could be written for it; reputedly some compilers could be run in 16 kilobytes. Furthermore, the original compiler, itself written in BCPL, was easily portable. BCPL was thus a popular choice for bootstrapping a system.[citation needed] 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. The back end took the O-code and translated it into the machine code for the target machine. Only 15 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, Java).

The language is unusual in having only one data type: a word, a fixed number of bits, usually chosen to align with the same platform 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 or on machines with larger word sizes such as 32-bit or 64-bit.[citation needed]

The interpretation of any value was determined by the operators used to process the values. (For example, + added two values together, treating them as integers; ! indirected through a value, effectively treating it as a pointer.) In order for this to work, the implementation provided no type checking.

The mismatch between BCPL's word orientation and byte-oriented 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 %).[4]

BCPL handles bindings spanning separate compilation units 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.[citation needed]

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.[citation needed]

BCPL was the first brace programming language 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 $) or [ and ] in place of the symbols { and }. The single-line // comments of BCPL, which were not adopted by C, reappeared in C++ and later in C99.

The book BCPL: The language and its compiler describes the philosophy of BCPL as follows:

The philosophy of BCPL is not one of the tyrant who thinks he knows best and lays down the law on what is and what is not allowed; rather, BCPL acts more as a servant offering his services to the best of his ability without complaint, even when confronted with apparent nonsense. The programmer is always assumed to know what he is doing and is not hemmed in by petty restrictions.[5]

History

BCPL was first implemented by Martin Richards of the University of Cambridge in 1967.[1] BCPL was a response to difficulties with its predecessor, Cambridge Programming Language, later renamed Combined Programming Language (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 under Compatible Time-Sharing System, was written while Richards was visiting Project MAC at the Massachusetts Institute of Technology in the spring of 1967. The language was first described in a paper presented to the 1969 Spring Joint Computer Conference.[citation needed]

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.[clarification needed][citation needed]

BCPL is the language in which the original "Hello, World!" program was written.[6] The first MUD was also written in BCPL (MUD1).

Several operating systems were written partially or wholly in BCPL (for example, TRIPOS and the earliest versions of AmigaDOS). BCPL was also the initial language used in the Xerox PARC Alto project. 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. 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, PDP-10, TX-2, CDC 6400, UNIVAC 1108, PDP-9, 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 hosted on BBN's TENEX PDP-10s, and directly targeted the PDP-11s used in BBN's implementation of the second generation IMPs used in the ARPANET.

There was also a version produced for the BBC Micro in the mid-1980s, by Richards Computer Products, a company started by John Richards, the brother of Martin Richards.[7] The BBC Domesday Project made use of the language. Versions of BCPL for the Amstrad CPC and Amstrad PCW 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.[8] 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++ (with ++ being C's increment operator),[9] 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 2023.[10] 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 for BCPL is text/x-bcpl.

Examples

Hello world

Richards and Whitby-Strevens[11] provide an example of the "Hello, World!" program for BCPL using a standard system header, 'LIBHDR':

GET "LIBHDR"
LET START() BE WRITES("Hello, World")

Further 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

  1. ^ a b c "Martin Richards (2003 Computer Pioneer Award)". IEEE Computer Society. Archived from the original on 24 November 2017. Retrieved 24 November 2017.
  2. ^ Pike, Rob (24 April 2014). "Hello Gophers". Retrieved 11 March 2016.
  3. ^ https://www.cl.cam.ac.uk/~mr10/bcplman.pdf The BCPL Cintsys and Cintpos User Guide, 2.1.4 Section brackets
  4. ^ "Clive Feather on CPL and BCPL". www.lysator.liu.se. Retrieved 1 March 2024.
  5. ^ Richards, Martin; Whitby-Strevens, Colin (1980). BCPL: The Language and its Compiler. Cambridge University Press. p. 5. ISBN 978-0521785433.
  6. ^ BCPL, Jargon File
  7. ^ "Reuters technical development: Glossary - THE BARON". www.thebaron.info.
  8. ^ Kernighan, Brian W.; Dennis M. Ritchie (1978). The C Programming Language. Bell Telephone Laboratories. p. 2. ISBN 0-13-110163-3.
  9. ^ History of C++ Retrieved 12 December 2017
  10. ^ Martin Richards. "BCPL/README (BCPL Cintcode distribution)".
  11. ^ Richards, Martin; Whitby-Strevens, Colin (1980). BCPL: The Language and its Compiler. Cambridge University Press. p. 8. ISBN 978-0521785433.

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) ISBN 0-521-28681-6

Read other articles:

This article has an unclear citation style. The references used may be made clearer with a different or consistent style of citation and footnoting. (May 2021) (Learn how and when to remove this template message) 2000 studio album by the Mountain GoatsThe Coroner's GambitStudio album by the Mountain GoatsReleasedOctober 17, 2000GenreLo-fiLength43:00LabelAbsolutely KosherProducerJohn DarnielleThe Mountain Goats chronology Full Force Galesburg(1997) The Coroner's Gambit(2000) All Hail W...

 

 

Cet article est une ébauche concernant une gare et la Gironde. Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants. Bassens Le bâtiment voyageurs et l'entrée de la gare. Localisation Pays France Commune Bassens Adresse Place de la Gare33530 Bassens Coordonnées géographiques 44° 54′ 05″ nord, 0° 31′ 21″ ouest Gestion et exploitation Propriétaire SNCF Exploitant SNCF Code U...

 

 

This article may rely excessively on sources too closely associated with the subject, potentially preventing the article from being verifiable and neutral. Please help improve it by replacing them with more appropriate citations to reliable, independent, third-party sources. (April 2017) (Learn how and when to remove this template message) Australian Production Design GuildLogo of the Australian Production Design GuildAbbreviationAPDGFormation2009; 15 years ago (2009)TypeGu...

Crater on Venus Crater on VenusMariko (Crater)Radar image of Venus Crater MarikoPlanetVenusCoordinates23°18′S 132°54′E / 23.3°S 132.9°E / -23.3; 132.9QuadrangleAphrodite TerraDiameter11.2 kmEponymMariko Mariko is an impact crater on Venus. In 1997 it was named for a common female Japanese first name, in accordance with planetary nomenclature rules for Venusian craters under 20 km in diameter.[1][2] The crater is located in the V-36 quadrang...

 

 

P13 DJKAStasiun LRT PalembangLokasiJalan Gubernur H. A Bastari, Sungai Kedukan, Rambutan, Banyuasin, Sumatera SelatanIndonesiaOperatorDivre III PalembangJalurP Lin PalembangJumlah peron2 peron sisiJumlah jalur2Operator KAKereta Api IndonesiaKonstruksiJenis strukturLayangParkirAdaFasilitas sepedaN/AAkses difabelYaInformasi lainKode stasiunDJKSejarahDibuka1 Agustus 2018 (2018-08-01)Operasi layanan Stasiun sebelumnya LRT Palembang Stasiun berikutnya Jakabaringke arah Bandara Sultan Mahmud B...

 

 

1941 film by Jean Yarbrough Father Steps OutDirected byJean YarbroughWritten byEdmond Kelso George WaggnerProduced byLindsley Parsons William T. LackeyStarringFrank Albertson Jed Prouty Lorna GrayCinematographyMack StenglerEdited byJack OgilvieMusic byEdward J. KayProductioncompanyMonogram PicturesDistributed byMonogram PicturesRelease dateJuly 19, 1941Running time63 minutesCountryUnited StatesLanguageEnglish Father Steps Out is a 1941 American comedy film directed by Jean Yarbrough and starr...

departemen perbelanjaan Isetan, Kokura Stasiun Kokura Kastil Kokura Lambang Kokura Kokura (小倉code: ja is deprecated ) adalah sebuah kota kastil kuno dan pusat Kitakyushu, Jepang, dijaga, melakukan subperkotaan-nya Moji, Selat Shimonoseki antara Honshu dan Kyushu. Penduduk terkenal Matsumoto Seicho - penulis Miyamoto Musashi - ahli persenjataan dan rōnin Mori Ōgai - fisikawan, penerjemah, novelis dan penyair Tetsuya Theodore Fujita - Meteorolog Figur terkenal yang lahir di Kokura Leiji M...

 

 

Neil deGrasse Tyson nel giugno 2017 Neil deGrasse Tyson (New York, 5 ottobre 1958) è un astrofisico e divulgatore scientifico statunitense, direttore dell'Hayden Planetarium dell'American Museum of Natural History, noto a livello internazionale per aver contribuito a far declassare Plutone a pianeta nano da parte dell'Unione Astronomica Internazionale nel 2006. Firma di Neil deGrasse Tyson Indice 1 Biografia 1.1 Primi anni 1.2 Percorso di studi 2 Carriera 3 Opinioni 3.1 Concezione spirituale...

 

 

Not to be confused with King Long. Fictional monster This article is about the character. For the film franchise, see King Kong (franchise). For the various films with the same name, see King Kong (1933 film), King Kong (1976 film), and King Kong (2005 film). For other uses, see King Kong (disambiguation). Fictional character King KongKing Kong characterKing Kong as featured in promotional material for the original 1933 film.First appearanceKing Kong (1933)Created byMerian C. CooperPortrayed ...

2020年夏季奥林匹克运动会波兰代表團波兰国旗IOC編碼POLNOC波蘭奧林匹克委員會網站olimpijski.pl(英文)(波兰文)2020年夏季奥林匹克运动会(東京)2021年7月23日至8月8日(受2019冠状病毒病疫情影响推迟,但仍保留原定名称)運動員206參賽項目24个大项旗手开幕式:帕维尔·科热尼奥夫斯基(游泳)和马娅·沃什乔夫斯卡(自行车)[1]闭幕式:卡罗利娜·纳亚(皮划艇)&#...

 

 

هيو جاكمان (بالإنجليزية: Hugh Jackman)‏    معلومات شخصية اسم الولادة (بالإنجليزية: Hugh Michael Jackman)‏  الميلاد 12 أكتوبر 1968 (56 سنة)  سيدني  الإقامة نيويورك  مواطنة أستراليا المملكة المتحدة[1]  استعمال اليد أعسر  الديانة المسيحية[2]  الزوجة ديبورا لي فيرنس (19...

 

 

Archaeology museum in Ann Arbor, MichiganKelsey Museum of ArchaeologyFormer nameMuseum of Classical ArchaeologyEstablished1928 (1928)LocationNewberry Hall434 S. State StAnn Arbor, MichiganTypearchaeology museumAccreditationAmerican Alliance of MuseumsCollectionsprehistoric through medieval timesCollection size>100,000DirectorNicola TerrenatoOwnerUniversity of MichiganWebsitelsa.umich.edu/kelseyNewberry HallU.S. National Register of Historic PlacesMichigan State Historic Site Show map ...

Spanish physicist This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Blas Cabrera – news · newspapers · books · scholar · JSTOR (July 2019) (Learn how and when to remove this message) This article is about the Spanish physicist. For the US physicist and grandson of Blas Cabrera Felipe, see Blas Cabrera Navarro....

 

 

Georgia: Water and Sanitation Data Access to an improved water source 100% (2015) [1] Access to improved sanitation 86% (2015) [1] Continuity of supply (%) Continuous in Tbilisi, intermittent in many other cities and towns Average urban water use (liter/capita/day) 800 in Tbilisi (2013),[2] much lower in many other towns Average residential water and sanitation tariff (US$/m3) 0.15 (2014) in Tbilisi; 0.22 (2016) outside Tibilsi; Share of household metering 22% in Tbil...

 

 

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Joe Flynn American actor – news · newspapers · books · scholar · JSTOR (February 2023) (Learn how and when to remove this message) American actor (1924–1974) Joe FlynnFlynn as Capt. Binghamton on McHale's Navy in 1963BornJoseph Anthony Flynn III(1924-11-...

American photographer (1852–1934) Gertrude KäsebierPortrait by Adolf de Meyer, c. 1900BornGertrude Stanton(1852-05-18)May 18, 1852Des Moines, Iowa, U.S.DiedOctober 12, 1934(1934-10-12) (aged 82)New York City, New York, U.S.Signature Gertrude Käsebier (born Stanton; May 18, 1852 – October 12, 1934) was an American photographer. She was known for her images of motherhood, her portraits of Native Americans, and her promotion of photography as a career for women. Biography Early ...

 

 

الشركة العقارية السعوديةالشركة العقارية السعوديةالشعارمعلومات عامةالبلد  السعوديةالتأسيس 15 يوليو عام 1976النوع تطوير عقاريالشكل القانوني شركة مساهمة — شركة عامة المقر الرئيسي يقع المكتب الرئيسي للشركة العقارية السعودية في مركز البلازا على طريق العليا، في مركز الأعم�...

 

 

ديوان المظالم ديوان المظالم (السعودية) تفاصيل الوكالة الحكومية البلد السعودية  تأسست 12 رجب، 1373 هـ18 مارس 1954 المركز الرياض،  السعودية شعبة المظالم بديوان مجلس الوزراء   الإدارة الوزراء المسؤولون خالد بن محمد اليوسف، رئيس ديوان المظالم إبراهيم بن عبدالله المطرودي، ن...

This Is the EndPoster resmiSutradara Seth Rogen Evan Goldberg Produser Seth Rogen Evan Goldberg James Weaver Tyler Edwards Skenario Seth Rogen Evan Goldberg BerdasarkanJay and Seth vs. The Apocalypse olehSeth RogenPemeran James Franco Jonah Hill Seth Rogen Jay Baruchel Danny McBride Craig Robinson Michael Cera Emma Watson Penata musikHenry JackmanSinematograferBrandon TrostPenyuntingZene BakerPerusahaanproduksi Mandate Pictures Point Grey Pictures DistributorColumbia PicturesTangga...

 

 

Voce principale: Kieler Sportvereinigung Holstein von 1900. Kieler Sportvereinigung Holstein von 1900Stagione 2009-2010Sport calcio Squadra Holstein Kiel Allenatore Falko Götz (1ª-9ª) Torsten Fröhling (10ª-12ª) Christian Wück (13ª-38ª) All. in seconda Bernd Heemsoth 3. Liga19º posto Maggiori presenzeCampionato: Müller (36)Totale: Müller (36) Miglior marcatoreCampionato: Holt (14)Totale: Holt (14) StadioHolstein-Stadion Maggior numero di spettatori6 016 vs. Wacker Burgha...