有没有人可以使用B编译器? [英] Does anyone have a working B compiler?

查看:60
本文介绍了有没有人可以使用B编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道我在哪里可以得到一个好的B编译器吗?我已经搜索了一段时间的B编译器,但是在找到适用于Windows或Linux系统的完整文件时遇到了一些困难.

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.

以下是B的示例:

main( ) {
auto a, b, c, sum;
a = 1; b = 2; c = 3;
sum = a+b+c;
putnumb(sum);
}

推荐答案

此问题提示,现在可以从此处获取B编译器:https://github.com/Leushenko/ybc

Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc

可在Windows,Linux和OSX(提供的二进制文件;本来是用晦涩的语言编写的)上运行的,因此会产生质量很差的x86-32程序集.应该与GCC兼容.它是从B上的可用参考资料中重建而来的,几乎可以肯定它并没有像1960年代那样反映该语言.值得注意的是,在没有类型信息的情况下(B是无类型的),& a [b] ==& *(a + b)规则不能成立x86,这意味着该任务实际上是不可能完成的(无需求助于解释器).

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).

除此之外,Pavel Minaev的评论是正确的:所描述的语言 非常小,远小于C,而且经验丰富/有能力的编译器程序员很可能在下午为您编写一个.

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.

不幸的是,这只是部分答案,因为我无法告诉您在哪里可以找到好的 B编译器.

Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.

这篇关于有没有人可以使用B编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆