第一个编译器是如何编写的? [英] How was the first compiler written?

查看:419
本文介绍了第一个编译器是如何编写的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说鸡肉和鸡蛋和自慰。我有几个问题。



是什么编写了第一个将某些东西转换为二进制指令的编译器?



编译或翻译成二进制指令?



...我很难相信他们用二进制编写了一个编译器。

这个用于6039微处理器,例如),它们用匹配的汇编指令列出它们,并且为诸如跳转之类的事情手动确定存储器地址/偏移。



第一个程序是以这种方式完成的 - 手写的操作码。



但是,大多数时候,使用汇编器编译程序集代码,它自动执行这些操作码查找,以及有助于计算命名的跳转标签的地址/偏移等。



第一个汇编程序是手工编写的。然后,这些汇编器可以用于汇编更复杂的汇编器,然后可以用于组装为更高级语言编写的编译器,等等。这种迭代编写工具以简化下一组工具的创建的过程被称为(如David Rabinowitz在他的回答中所提到的) bootstrapping


I heard about the chicken and the egg and bootstrapping. I have a few questions.

What wrote the first compiler that converted something into binary instructions?

Is assembly compiled or translated into binary instructions?

...I'd find it hard to believe they wrote a compiler in binary.

解决方案

Assembly instructions are (generally) a direct mapping to opcodes, which are (multi-)byte values of machine code that can be directly interpreted by the processor. It is quite possible to write a program in opcodes directly by looking them up from a table (such as this one for the 6039 microprocessor, for example) that lists them with the matching assembly instructions, and hand-determining memory addresses/offsets for things like jumps.

The first programs were done in exactly this fashion - hand-written opcodes.

However, most of the time it's simpler to use an assembler to "compile" assembly code, which automatically does these opcode lookups, as well as being helpful in computing addresses/offsets for named jump labels, et cetera.

The first assemblers were written by hand. Those assemblers could then be used to assemble more complicated assemblers, which could then be use to assemble compilers written for higher-level languages, and so on. This process of iteratively writing the tools to simplify the creation of the next set of tools is called (as mentioned by David Rabinowitz in his answer) bootstrapping.

这篇关于第一个编译器是如何编写的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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