BCPL manual from 1974

3 Likes

An interesting read although later versions are arguably better to understand…

-Gordon
(Probably the 2nd last BCPL programmer on the planet)

I found it interesting in that . op indicated floating point at this time.
It is also one of the few programming langagues, with out the dreaded ;
I just wish I could use [ ] for $( and $). Ben.

Some markup problem mangled what you were trying to say?

I wish I could use square brackets for for section brackets.

Presuming you mean “dot” or “.” above…

Despite having its roots in 1967, BCPL is actively maintained (well, as actively as an 80+ year old can maintain it!) The last update was earlier this year for example…

Floating point is supported and has been supported for a number of years now. It’s not “pretty” though but it is there (and, notably, optional!) The prefix operator has moved from “.” to “#” though.

The precision/width of the floating point numbers is the same as the native word width of the underlying machine. So today it’s typically 32 or 64 bit numbers (IEEE 754).

  LET a = 10.0
  LET b =  6.0
  LET c = ?

  c := a #/ b

So operations are prefixed with the # symbol to indicate the operation ought to take place using floating point rather than integer. (And there are built-in FLOAT and FIX operators to assist in mixed-mode calculations when needed)

I think MR dropped FP from his version of the compiler for some time though - the BBC Basic version doesn’t support it (integer only) but did come with an optional floating point library to use small vectors (arrays) to store floating point numbers. There are notes in the later manuals where he says he resisted adding it for a long time…

As for sections: $( and $) still work, but curly brackets {…} were introduced sometime in the late 70s…

GET "libhdr"
LET start () = VALOF
{
  writef ("Hello, world!*n")
  RESULTIS 0
}

-Gordon

1 Like

I like the long checklist in the linked manual of things which need to be sorted out for a new platform, including accommodating the character set, and the maximum sizes of various things, like identifiers and the stack.

2 Likes

“{” and “}” are also the preferred representation in this 1974 manual, “$(” and “$)” are just used to avoid ambiguity:

2.3.2 Section Brackets

The preferred representation of a left section bracket consists of { followed by zero or more letters, digits, and other characters allowed in names. A right section bracket consists of } followed by zero or more letters, digits, etc. As the symbols { and } are used in this manual as meta-linguistic brackets, section brackets in the syntax and examples are represented using an alternate form also suitable for more limited character sets.

However, in contrast to this, curly brackets are not listed among the canonical symbols. (Which is kind of interesting, as they probably should be. Well, they are not required to represent BCPL, but, on the other hand, they do have a distinct syntactic value.)

1 Like

Maybe 1974 was just late enough to be considering punched card users, since the FORTRAN character set didn’t have/need curly brackets. But every IBM character set had “$ ( )” for accounting

2 Likes

An interesting anecdote here is that an old friend if mine was interested in BCPL in the late 70s and MR sent him a tape of the compiler, etc. however as it featured lower-case characters and all he had at the time was a TTY33 he was unable to use it…

So it’s easy to see why things like *( existed rather than { once upon a time…

-Gordon

2 Likes

The Teletype Model 33 and 35 also did not have curly brackets (which makes it surprising to me that they feature so heavily in C). The Unix tty handler, for example, translated { to \( and } to \).

1 Like

This is the first time I have heard that detail, I guess books after 1975 omit that. Time to patch linux.

I had also never heard this before, and in fact when I got a M35 I was quite surprised that its keyboard has neither | nor { }, all characters that I associate strongly with Unix and C. I had known that the original pipe character was ^; it turns out this is actually an up arrow on a Model 35 (which is ASCII '63) and looks kind of like a pipe, which is probably why it morphed to |. Curly braces I simply cannot explain. It’s particularly surprising to me that K&R '78 does not mention this, nor case, while it seems probable to me that most C programmers were using Model 33s during the development and soon after release of that book.

In order to figure out how to type { on my Model 35, I consulted the kernel source. :wink: I later learned that this was symmetric, and the output also shows \(, so thereafter I created a set of characters on a glass tty and simply catted it to the Teletype.

1 Like

I wrote a little of BCPL back in the 80s and it was a PITA. In the 60s and 70s there were still enough computers in circulation that used 5 and 6 bit character sets that I can understand why they didn’t want to use something as “advanced” as square brackets. I just wish they had taken the C++ trigraph approach where they were synonyms.

There was a lot to like about BCPL, along with the languages it spawned

You had square brackets. I think it just was pure marketing, that ASCII came out
to get rid of the other guys. IBM and AT&T vs … .
The mess ASCII made was they did not define a LOWER case set in 1963.
They did in 1965. They went INTERNATIONAL in 1967. Make the UK happy
with a Pound sign. Throw in a acent mark here and there, and move stuff around.
Bribe Canada with a EH.
Why ASCII needed all the control chars I can never figure out. they could of dropped
some, for use as ACENT marks.

Except there isn’t a pound sign in ASCII.

What was sometimes done was substitute character number 35, # for a different printed symbol; ÂŁ.

It wasn’t until “code page 437” happened then iso8859/Latin-1 some years later than things settled down a little and £ got it’s own number (163) And even then, some systems didn’t adopt it, or had already adopted another 8-bit set number for the £ and other symbols.

It was a mess then, some say still a mess now…

-Gordon

This is, where (in the “extended codepage”) U+00A4, “¤”, the character in between the British Pound (also Lira and other synonymous currencies, Pound is the English equivalent) and the Yen comes in, which was meant as a replacement character for individual currency signs.
(So, in theory, this can appear as about anything. It’s your commercial chameleon character.)
We can’t all have Thalers, you know, the banner wound around the Pillars of Heracles… :wink:

They were meant for field, record and file management. Very few of them got used in that way, at least when exposed to the the user. Ctrl-Z as EOF is perhaps the most common one, which you quite often encountered on CP/M

Don’t forget ETX, End of Transmission, also known as ^C…

BTW, I think, ASCII is actually quite clever: drop a bit on the number line of the keyboard and you get the corresponding shifted characters, drop another bit and you get unified upper-case, drop yet 2 bits and you get the control code range. It can be done with very little hardware and requires no code at all. (Your shift and control keys only have to break a line, and case conversion is as simple and fail-safe as can be.)

Moreover, all your stream/communications related hardware only has to handle (i.e., implement) the lowest 5 bits, where all the control characters are, and the essential ones are all in the low 4-bit range.

1 Like