在编译器之前有编程语言吗?

发布于 2024-12-09 06:13:38 字数 100 浏览 0 评论 0原文

显然,必须有一种编程语言可以为其编写编译器,但是人们过去是否用COBOL(或其他语言)编写,然后手动将其编译为汇编语言,或者都是用汇编语言编写的,直到有人想到一种更高级的语言?谢谢,呃。

Obviously there must have been a programming language to write a compiler for, but did people used to write in say COBOL (or whatever) and then hand compile it to assembly or was it all written in assembly until someone thought of a higher language? Thanks, ell.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笑着哭最痛 2024-12-16 06:13:38

编程语言编译器的概念是携手发展的。人们普遍认为 Grace Hopper 开发了第一个编译器:

1952 年,Hopper 完成了她的第一个编译器(用于 Sperry-Rand 计算机),称为 A-0 系统。正如她后来所说,她这样做是因为她很懒,希望程序员能够回归数学家

A-0系统实际上是一组可以将符号数学代码翻译成机器语言的指令。在制作 A-0 的过程中,霍珀将她多年来收集的所有子程序都记录在磁带上。每个例程都有一个调用号,以便机器可以在磁带上找到它。正如霍珀所描述的那样——“我所要做的就是写下一组索书号码,让计算机在磁带上找到它们,将它们带过来并进行添加。这是第一个编译器。”

来源:http://history-computer.com/ModernComputer/ Software/FirstCompiler.html

正如维基百科所述, “A-0 的功能更像是加载器或链接器,而不是现代概念的编译器。” (它实际上是编译在一起的子例程,因此得名。)我目前手头没有任何更详细的参考资料,但你可以想象 A-0 和类似程序的输入过程可以逐步进化得更加复杂——更像是现在所谓的“高级编程语言”——编译器承担更多的现代功能,作为翻译器,而不仅仅是代码编译器(但是这个名字被卡住了)。

您可能可以在 Hopper 在第一届“编程语言的历史”会议上发表的主题演讲的记录中找到更多详细信息,该记录发布在 HOPL I 会议记录。如果我没记错的话,她在那里描述了从 A-0 到她后来的工作的演变过程,这些工作也启发了 COBOL;但我自己还没有重新阅读这篇文章。

有趣的是,霍珀说她遇到了对程序编写程序的想法的抵制:

“我有一个正在运行的编译器,没有人会碰它,因为他们仔细地告诉我,计算机只能做算术;他们不会做程序。”

来源:http://www.computinghistory.org.uk/det/5487/Grace%20Hopper%20completes%20the%20A-0%20Compiler

The notion of programming languages and compilers evolved hand-in-hand. Grace Hopper is generally credited with having developed the first compiler:

In 1952, Hopper completed her first compiler (for Sperry-Rand computer), known as the A-0 System. As she said later, she did this, because she was lazy and hoped that the programmer may return to being a mathematician.

The A-0 System actually was a set of instructions that could translate symbolic mathematical code into machine language. In producing A-0, Hopper took all the subroutines she had been collecting over the years and put them on a tape. Each routine was given a call number, so that it the machine could find it on the tape. As described by Hopper—“All I had to do was to write down a set of call numbers, let the computer find them on the tape, bring them over and do the additions. This was the first compiler.”

Source: http://history-computer.com/ModernComputer/Software/FirstCompiler.html

As stated on Wikipedia, “The A-0 functioned more as a loader or linker than the modern notion of a compiler.” (It kind of literally compiled together subroutines, hence the name.) I don't have any more detailed references on hand at the moment, but you can imagine that the input that A-0 and similar programs could process evolved incrementally to be more complex—more like what is now called a “high-level programming language”—with compilers taking on more of their modern function as translators and not mere compilers of code (but the name stuck).

You can probably find more details in the transcript of the keynote address that Hopper gave at the first “History of Programming Languages” conference, as published in the HOPL I conference proceedings. If I remember well, she describes there how things evolved from A-0 to her later work that also inspired COBOL; but I didn't re-read the article yet myself.

It's interesting and amusing to note that Hopper says she encountered resistance to the idea of a program that wrote programs:

“I had a running compiler, and nobody would touch it because, they carefully told me, computers could only do arithmetic; they could not do programs.”

Source: http://www.computinghistory.org.uk/det/5487/Grace%20Hopper%20completes%20the%20A-0%20Compiler

温暖的光 2024-12-16 06:13:38

为了直接回答这个问题,程序员没有使用正式的高级语言,然后手工转换为汇编语言。他们使用流程图(一种图形语言),然后直接对汇编进行编码。根据这篇关于流程图的文章,冯·诺依曼在 1947 年就使用了它们电子计算。

在编译器出现之前,大多数代码都是用汇编语言编写的。有人可能会说汇编器是一种原始类型的编译器,因为它将助记符(例如mov reg1,[reg2])转换为操作码 >。

在汇编器出现之前,操作码是直接输入的。由于没有只读存储器,因此通过使用 上的开关实际设置字节来输入引导例程>前面板

编译器构建历史维基百科文章可能会有所帮助。

To answer the question directly, programmers didn't use formal high-level languages and then convert to assembly by hand. They used flow charts, which are a kind of graphical language, but then coded the assembly directly. According to this article on flow charts, Von Neumann used them in 1947, right at the advent of electronic computing.

Before compilers most code was written in assembly language. One could argue that an assembler was a primitive type of compiler, since it would convert mnemonics such as mov reg1, [reg2] into op-codes.

Before assemblers, op-codes were entered directly. Since there was no read-only-memory, boot routines were entered by actually setting the bytes with switches on a front panel.

The History of Compiler Construction Wikipedia article might be helpful.

段念尘 2024-12-16 06:13:38

当然。

Plankalkül 是由 Konrad Zuse 于 1943 年提出的。(没有人为其编写编译器50 年了,而写下这篇文章只是为了表明它可以做到)。

大多数其他人首先发明了各种二进制编码方案,然后是汇编程序。

Fortran 可能是第一个得到广泛使用的“高级”语言。

Sure.

Plankalkül was proposed by Konrad Zuse back in 1943. (Nobody wrote a compiler for it for 50 years, and the one that was written was done to simply to show it could be done).

Most other folks first invented various binary coding schemes followed by assemblers.

Fortran was probably the first "high level" language to see any wide spread usage.

难理解 2024-12-16 06:13:38

编译器通常是引导的。这意味着编译器是用已经存在编译器的语言编写的。

常见的是,有些编译器是用它们编译的相同语言编写的:Mono 编译器是 C#,Vala 编译器是 Vala。

对于 Mono,它是使用 Microsoft C# 编译器进行编译的,直到 Mono 能够自行构建为止。就 Vala 而言,编译器(据我所知)是用 C 编写的,直到它可以编译足够的 Vala 来重写 Vala 中的编译器。

所以你是对的。如果没有其他编译器可用,某些编译器在某些时候必须用汇编语言编写。或者至少包含用另一种语言编写的功能较弱的编译器版本,只是为了引导编译器。

Compilers are usually bootstrapped. This means the compiler is written in a language for which a compiler exists already.

It is common that some compilers are written in the same language they compile: Mono Compiler is C#, Vala compiler is Vala.

In the case of Mono, it was compiled using Microsoft C# compiler until Mono was able to build itself. In the case of Vala, the compiler was (AFAIK) written in C until the point it could compile enough Vala to rewrite the compiler in Vala.

So you are right. Some compilers had to be written in assembly at some point, if no other compiler was available. Or at least a less capable version of the compiler writting in another language is included just to bootstrap the compiler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文