Does anyone have a working B compiler? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionDoes anyone know where I could get a good B compiler? I ha开发者_如何学编程ve searched for a B compiler for some time now, but have been having some difficulty finding anything complete for a Windows or Linux system.
Here is an example of B:
main( ) {
auto a, b, c, sum;
a = 1; b = 2; c = 3;
sum = a+b+c;
putnumb(sum);
}
Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc
Runs on Windows, Linux, and OSX (binaries provided; in the spirit of the question it is written in an obscure language), where it produces very poor quality x86-32 assembly. Should be GCC-compatible. It is reconstructed out of the available reference material on B, and almost certainly does not reflect the language as it really was in the 1960s. Notably, in the absence of type information (B is untyped), the &a[b] == &*(a + b)
rule can not hold on x86, meaning that this task is effectively impossible (without resorting to an interpreter).
Apart from that, Pavel Minaev's comment is right: the language as described is extremely small, far smaller than C, and an experienced/competent compiler programmer could likely write one for you in an afternoon.
Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.
Do you have a Honeywell 6050 running GCOS to run it on? Or maybe an emulator? I know that IBM's 360 and 370 have been emulated but I haven't yet heard of a Honeywell 6000 emulator.
At the University of Waterloo in 1974-76 timeframe I remember writing CS assignments in B rather than Algol-60 which most people in the class were using. I went on to write an emulator for an HP 2100A minicomputer, but that code is long since lost.
As far as I know, B was only implemented on the Honeywell with its 36-bit word length, 9-bit ASCII, etc. And since it's successor C, was hitting the universities at the same time, it didn't last long.
If I remember correctly, Trevor Thompson, one of the founders of MKS, wrote a standard I/O library for B and also wrote a 3D chess game in it. If you can manage to track him down, he is someone who, at one time, had his hands on a B compiler. I just had a look at LinkedIn and I found him. He is one of the owners of Satori Solutions.
If you have a machine running GCOS, or a Honeywell series 60 emulator running GCOS, then you could use the B compiler included in the UW Tools Package from Thinkage. It supports both batch and TSS programs.
精彩评论