• Please review our updated Terms and Rules here

working B compiler?

carangil

Experienced Member
Joined
Jun 3, 2009
Messages
285
Location
Oakland, CA
Does anyone know what was the latest compiler written for the 'B' ( pre-C ) programming language? Was an x86 version ever written?

I've recently read the book 'A Quarter Century of Unix,' and find the simplicity of B to be appealing. I know its out of date, and not really of use to anyone, but I just want to play around with it. For the same reason that I fire up my CoCo now and then and starting playing around in random BASIC.
 
Although I know nothing about the language in question, perhaps it is possible to develop a front end and attach to an existing code generating back end. See for example how the GCC compiler suite is built up: different front ends for C, Fortran, Java, Pascal etc but a common back end if I recall correctly. If the B language is anything similar to C or Pascal, it may be within reach for a dedicated hobby developer.
 
Maybe that would work. B is basically the prototype for C.

In B there's only one type, the word, which you can use as an integer or dereference as a pointer. It's sorta like C if every variable was a union of a void* and an integer.

I'll look around some more. B-to-C converter could probably be written trivially. I kind of like using C as a backend language. Want to make your own language with all the latest compiler optimizations? Just parse it and spit out some mangled C code, and let gcc or msvc crank away at it.
 
I visited Xerox on Coyote Hill Road in Palo Alto (not Xerox PARC) sometime in the 80s and they mentioned that they used B on some of their applications. I was suprised--B was an anachronism even then. I'm thinking this was about 1983, so at least you have a date. I don't recall what they were using for iron, however.
 
Bcpl

Bcpl

Xerox used BCPL, not B, on the Alto and their PDP-10 clone, MAXC

If you want to try B, just play with BCPL, which is very similar and has
compilers on x86
 
Last edited:
Xerox used BCPL, not B, on the Alto and their PDP-10 clone, MAXC

If you want to try B, just play with BCPL, which is very similar and has
compilers on x86

Then the guy I talked to must have been talking through his hat. He definitely said "B". He was management, so maybe he was confused. :)
 
B was considered a toy language even in the late 70's. I played with it for a while, and was frustrated by the lack of features. When I first heard of C, my experience with B put me off it for quite a while--I assumed it'd be just as crippled. B is more of a hack than a language. It'll only solve a small subset of problems--imagine a scripting language...that Bourne shell can blow away.

Tiny BASIC was more of a language, and it had an excuse for being limited (price differential between a 2K and a 4K EPROM).

It might be worth playing with for history's sake, I guess. I'd be very surprised if there's not source code on the 'net (probably for PDP-7 or something like.)

C is B with features. ;)
 
I guess if you really wanted a x86 based "B" compiler, you could get your hands on a decent x80 to x86 translator. There used to be programs like that on Simtel (guess their still around?).

Probably wouldn't be too difficult writing a 'B' compiler from 'C' I guess? :rolleyes:
 
So not really any point in designing a modern Visual B#++.NET version?

I was more like the gibberish of Stackless Visual B#++.NET on Rails
:)

I did more reading up on B, and yes it is quite primitive, and maybe not worth the effort of getting it going. What attracted me to it was the idea of a single datatype: the WORD. It reminded me of two other languages I used to like coding in: FORTH and assembly. FORTH is easy once you get the hang of it, but some things like math expressions become awkward. Programs with lots of dynamic management (linked lists, trees,etc) get awkward fast. Assembly is just insane most of the time. I was thinking B might be a simpler, faster, closer-to-the-metal version of C, but after looking through the documentation I've found on it, I'm starting to realize there's a real good reason why C was developed. :)
 
I did more reading up on B, and yes it is quite primitive, and maybe not worth the effort of getting it going. What attracted me to it was the idea of a single datatype: the WORD.

This was a characteristic B inherited from BCPL.
BCPL IS available for the x86

here is a pointer to Martin Richard's current version
http://www.cl.cam.ac.uk/~mr10/BCPL.html
 
Last edited:
Yeah, and the WORD was whatever that machine's word was, too. I first used B on a PDP-11, much of the code had been brought over from PDP-7 and was buggy as all get-out--18 bit assumptions on a 16 bit computer!

There was no easy handling of character data...roll your own. It was like writing apps using nothing but bc. Good enough for calcs, bag the user interface.

Want close to the metal? Implement your own FORTH. :D It's fun, and you can write the core in assembly, C, or BCPL.

I was more like the gibberish of Stackless Visual B#++.NET on Rails :)

I love it. I wanna play.

Stackless OOXML Visual B#++.NET on Rails 5.0 JIT Runtime for Windows Phone 7
 
Then the guy I talked to must have been talking through his hat. He definitely said "B". He was management, so maybe he was confused. :)

I was surprised BCPL was available on the system I used - Disk & ROM versions (from the same company) which came out in the mid-80s. I was kind of expecting something Algol-ish, though the programs which accompanied the software was very diverse from the Text Editor they had written in it to the Space Invaders clone. The Invaders clone was extremely fast too - zapping the last alien was extremely difficult.

Afterwards I was checking out the source code and could see some of the connections it had with C, so I was just wondering if it were possible to mix up BCPL with B?
I haven't seen B source code before, so I'm not sure where the differences were with BCPL or B nor am I aware what differences C has with BCPL, all I can tell is their related. :( I'm unsure what the original BCPL was like either, so it may just be the code I was looking at had some provisions included in it to make it more powerful. :eek:
 
Whilst "B" is descended from BCPL its more limited. There is a paper from Dennis Ritchie here:-

http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

that explains some of the changes. His home page is preserved and also links to other "B" compilers and early "C" compilers and there is more info on his preserved home page here:-

http://cm.bell-labs.com/cm/cs/who/dmr/

I used "B" on a Honeywell mainframe, and "B" is still available on these to this day:-

http://www.thinkage.ca/english/gcos/product-uwtools.shtml

There is more info on the language here:-

http://cm.bell-labs.com/cm/cs/who/dmr/bintro.html

I did exchange some e-mails with Dennis Ritchie about "B" compilers as he collected old compilers, but we never found a copy of a "B" compiler. The University Of Waterloo don't seem to have a copy, nor do the "OpenWatcom" folks.

If you want a simple "C" compiler then on of the "tiny C" compilers that are available around the net.
 
Back
Top