Does anyone have a working B compiler? [closed]

老子叫甜甜 提交于 2021-02-04 09:59:10

问题


Does anyone know where I could get a good B compiler? I have 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);
}

回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/1601243/does-anyone-have-a-working-b-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!