B, resurrected

Community Forums/Showcase/B, resurrected

Yasha(Posted 2014) [#1]
This is kinda dumb (and rather lightweight for this section, but not sure where else it would go), but it's the sort of thing that makes me smile, because I'm weird that way.


I was shocked positively shocked to discover that nobody (that the mighty SO could find, and obviously there is no world outside that) has a working B compiler for modern ("modern") systems. So, now BlitzMax is doing its part to keep an important little piece of history alive...

...with a B compiler for x86!


I'm way too young to have ever seen this language operate for real (I think everyone here is), so the language is reconstructed from Thompson's manual and Ritchie's tutorial. I have not bothered to look at any real B programs beyond the short examples contained in those documents (wouldn't know where to find 'em anyway). The language is rather poorly-specified (those documents are like 10 pages max), with some self-contradiction; it's not really a fixed target anyway as they kept improving it until it turned into C.

Programs compiled with ybc can interoperate with BlitzMax (see tests/test0.b and tests/testb.bmx), if you're retro-crazy. I haven't bothered with the standard library from the manual, you can just use C's library functions if you need to (for printf and so on).

The machine code generated by this compiler is downright appalling, but, y'know, single-pass and all that. This implementation differs from the language in the manual in a couple of important but necessary respects, which are explained in the readme.


Brucey(Posted 2014) [#2]
Very cool !

Shame it's only generating x86 asm though... :-p


Floyd(Posted 2014) [#3]
I used c but never even saw b.

It's not exactly related but I also used bc. That was actually a calculator, handy for arbitrary precision arithmetic.


Henri(Posted 2014) [#4]
There was also E-language which came on a disk with some Amiga magazine. Seemed very C like.

-Henri


BlitzSupport(Posted 2014) [#5]
I do like to see 'apparently pointless' research/for-the-heck-of-it projects like this!

Continuing the Amiga-related note, much of the early AmigaDOS was written in BCPL, on which B was apparently based before it morphed into C.


There was also E-language which came on a disk with some Amiga magazine. Seemed very C like.



I may even still have that disk... ahem. Amiga E does still live on and get updated now and then! It even has Windows support, supposedly.


Steve Elliott(Posted 2014) [#6]

I do like to see 'apparently pointless' research/for-the-heck-of-it projects like this!



Agreed. More fun than playing yet another FPS...Actually these days it says frames per second to me, rather than First Person Shooter. :)


Henri(Posted 2014) [#7]
From the E website;

C++ considered Harmful (and why E is better)


Sounds a bit like something Yasha wrote :-)

-Henri