Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
BCPL evolved from CPL. (2021) [pdf] (cam.ac.uk)
31 points by fanf2 on May 11, 2024 | hide | past | favorite | 23 comments


> BCPL [...] used an area of memory called the global vector [...] to allow separately compiled modules to share variables. The GLOBAL declaration allowed the programmer to name elements of the global vector, and there was a rule that global variables would be initialised to the entry points of functions if their names matched the names of declared global variables. This initialisation took place when modules were loaded. [...] this mechanism is not beautiful and much hated by some

"Not beautiful and much hated by some" is a masterful piece of understatement.

This is what a GLOBAL declaration looks like:

    GLOBAL
    $(
        printf : 89
        programmeriq : 90
    $)
You're reading that correctly. There is no symbolic linkage in the language. You declare the specific numeric slot in a global array you think your function or global variable should occupy. You hope nobody else uses the same ones. That's how you call functions defined in other compilation units.


Sounds like the COMMON section in BASIC. Although there you couldn't even supply indexes. "Remember that variable order and type are significant, not variable names. The order and type of variables must be the same for all COMMON statements communicating between chaining programs." -- http://qbasicnews.com/qboho/#topic-qb45advr-T0085


Sounds like declaring a uniform buffer in GLSL. Everything old is new again!


.. or Zero-page in 6502, which is like a page of registers which everyone has to agree on meaning ..


In the late 1980s I wrote much of the code for my PhD in BCPL, despite C being available. It was clean, clear, and when you wrote code it was obvious what it was going to do. The type-less nature wasn't a problem, and co-routines were invaluable, bordering on indispensable.

I also assisted in bootstrapping BCPL on a self-built machine, and it was so easy. I liked it, though I'm not sure I'd go back to it.

I also chatted with Martin Richards for a while about MCPL, but never found the time to dive into that.

Fun times.


MCPL's one of my influences[0] so that line's continuing. Dum spiro spero

Richards wanted to build a flight simulator a while back, so he added floating[1] point. Richards 1 - Yaks 0: that yak got shorn.

[0] I guess I should ask Richards how much influence he got from Backus?

[1] would Moore have done it in fixed? or are there stability problems with that?


Students I knew who had him as a lecturer referred to it (derisively) as Martin’s Completely Perfect Language.


Does that imply CPL was not Cambridge, nor yet Combined, but rather Christopher's Perfect Language?

(the EE's of the time had not yet perfected their art sufficiently for CPL to have been viable for personal computing; does it work better now that we have GHz and GB?)


I also chatted with Mr. Richards for a while, after porting BCPL to the GP2X handheld 'underground' gaming machine, and using BCPL to emulate an EDSAC on which I wanted to run XOX, thus claiming the title of 'oldest title to be ported to the GP2X', for a while.

Mr. Richards got himself a GP2X after a while, and then saw how folks were porting BCPL all over the place, and I think he kind of got a big kick out of that .. we fell out of touch, but it was really a worthwhile effort to port BCPL like that, and attract the attention of the master ..


> a stripped down and syntactically changed version of BCPL, called B, was the language on which the C programming language was based.

https://en.wikipedia.org/wiki/BCPL


And then their descendant Perl took both the P and the L for its file extension .pl. Or so Larry Wall told me.


A very interesting paper. BCPL was the language used for the Xerox Alto computer, e.g. to build the first graphic WYSIWYG text editor and desktop publishing application.

Martin Richards, How BCPL Evolved from CPL, The Computer Journal, Volume 56, Issue 5, May 2013, Pages 664–670, https://doi.org/10.1093/comjnl/bxs026

Published: 20 March 2012 (not 2021)


Christopher Strachey the designer of CPL deserves a shout out. He also wrote a very early checkers program, invented time sharing, created denotational semantics with Dana Scott, came up with the idea of L values and R values, and coined the term currying.


> Christopher Strachey the designer of CPL deserves a shout out. He also wrote a very early checkers program, invented time sharing

Did he invent time sharing? He presented a very influential paper on the topic at the 1959 UNESCO International Conference on Information Processing in Paris. But, John McCarthy says he was already thinking about the topic in 1955. [0] And John Backus proposed the idea at an MIT conference in 1954. [1]

So, while no doubt he played a big role in popularising the concept, it is questionable whether he actually "invented" it. Maybe, he came up with the idea independently of McCarthy and Backus – but if that is true, it isn't clear that he thought of it first

[0] https://www-formal.stanford.edu/jmc/history/timesharing/time...

[1] https://bitsavers.org/pdf/mit/whirlwind/summer_session_1954/... see PDF page 78, in particular "John Backus said that by time sharing, a big computer could be used as several small ones; there would need to be a reading station for each user" (my emphasis)


Got it. But he did get a patent for the invention.


Getting a patent doesn’t mean no prior art exists, it just means the Patent Office can’t find it. That’s true today, but was even more true in the 1950s/1960s when patent offices had access to far less information. It is easy for us to find this 1954 conference proceedings from MIT, how would a patent examiner back then find it, or even know to look for it?


Makes perfect sense, and important ideas tend to occur in multiple places over a shortish period of time.


Much of the software for the Xerox Alto was orginally written in BCPL.

Also the original AmigaDOS was written in BCPL. This caused some complications later when they decided to use C as the primary system programming language. In AmigaDOS BCPL pointers are "word" (2 byte) addressed, which was a common form of addresses for computers of the time (inherited from non-power of two sized word computers such as the 36-bit machines of the 60s and 70s). C uses byte addressing, so it requires a bit shift to convert between BCPL's word addressed pointers and C's byte addressed pointers.


Amiga Inc. were using C and assembly as the primary languages for AmigaOS before BCPL entered the picture. They were up against deadlines and had no disk operating system.

A third party company, MetaComCo, was known to be selling a a MC68000 port of TRIPOS (which was written in BCPL because its author created BCPL), so they shoehorned TRIPOS into the Amiga operating system and called it AmigaDOS.

It was basically a black box. AmigaOS had an open, documented, normal way to operate, with shared libraries and devices, relocatable executables, callable from any language, including C - because all parameters were passed in registers and each function had to explicitly declare which registers were used, so none of this "I'll write it in C, and if you call me, just remember to use my C compiler's calling convention" nonsense that is now standard practise and people using other languages say C is over-privileged because it's base-level glue... on a single-architecture system like the Amiga, register declarations are base-level glue!

However, any time you went near AmigaDOS, it was quirky crap where all pointers were divided by 4 (because in BCPL there are no datatypes, just machine words, and machine word 0 is 4 bytes after machine word 1 on a 8-bit byte-addressable machine with 32-bit machine words), and there was the "global vector" for accessing shared functions, rather than standard Amiga libraries.

Amiga Inc. were pushed into rewriting in C by Charlie Heath et al, founders of the "AmigaDOS Replacement Project" (ARP)... ultimately almost all of AmigaDOS and its utility commands were rewritten in C for AmigaOS 2.0, and dos.library grew substantially in functions (most of which were already in AmigaDOS, but not visible outside BCPL code)


And eventually ported to Mesa, as means to improve quality and soundness.

https://www.softwarepreservation.org/projects/mesa/


Fun fact: for a year or so I shared an office with Colin Whitby-Strevens (co-author with MR of the BCPL book). Also have written BCPL although not a great deal. I think I had a 6809 compiler once upon a time.


Worked for a company writing book publishing software in BCPL, we also built our own display terminals. Then SUN workstations came along so we wrote ( or the brains at the company did) a BCPL->C compiler


Started with BCPL on CP/M when I couldn’t get a C compiler.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: