说C是用C编译的是什么意思?
我见过这样写的东西...C 是用 C 编写的,或者ABAP 是用 ABAP 编写的..
我什至见过一个人 说这是将语言排序为 < 的标准之一em>真正的编程语言。
我希望有人向我解释这意味着什么。
提前致谢。
编辑:将标题从“C 是使用 C 制作的”更改为“C 是使用 C 编译”。
I've seen stuff like this written... C was written in C, or ABAP was written in ABAP..
I've even seen one guy saying that this is one of the criteria to sort languages into true programming languages.
I'd like someone to explain to me what this means.
Thanks in advance.
EDIT:Changed title from: "C was made using C" to "C was compiled using C".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您从汇编开始,制作第一个版本,并且始终可以使用先前版本编写新版本的编译器。
您不需要编译器来启动以其语言编写的编译器。您只需要为 C 子集编写一个解释器。然后您可以使用这个子集来增强它。
在 C 发明时(大约 1967 年),除了 Brian Kerninghan 和 Dennis Ritchie 之外,没有人认为用高级语言编写编译器或操作系统是一个明智的想法。事实证明他们是对的!
You start with assembly, you make a first version and can always write a new version of a compiler with the previous version.
You do not need a compiler in order to start compiler written in its language. You just need to write an interpreter for a C subset. Then you use this subset in order to enhance it.
At the time C was invented (around 1967) nobody thought it was a sane idea to write a compiler or an Operating System in a high level language, except Brian Kerninghan and Dennis Ritchie. They proved to be right!
这意味着 C 编译器是用 C 编写的。
最初,这是一个问题,因为如果还不存在 C 编译器,你怎么能用 C 编写编译器。
更新:
如果你用不同的语言编写编译器当人们问自己这种语言是否对于构建编译器来说过于有限,或者该语言的发明者是否不相信他们的语言而更喜欢另一种语言。
但是用不同的语言编写编译器是有充分理由的。
It means that the C compiler was written in C.
Initially, that's a problem because how can you write a compiler in C if not compiler exists yet for C.
Update:
If you write a compiler in a differnt language, people ask themselves whether the language is too limited for building a compiler or whether the inventors of the language aren't convinced of their language and preferred another one.
But there are good reasons for writing a compiler in a different language.
编译器是相对复杂的程序,因此有时认为能够编写类似编译器的东西表明计算机语言有足够的能力来编写复杂的程序——即“真正的”编程语言。
编译器不必使用与编译时相同的语言编写。例如,如果使用 C 编写 Pascal 编译器,它仍然满足(有点不科学)C 是真正的编程语言的测试。
显然,要进行测试,必须有一些计算机语言不够强大,无法编写编译器,或者它可能非常复杂,以至于根本没有尝试过。某些 4GL、某些脚本语言或专用语言(你能用 LISP 编写编译器吗?我不知道...)可能属于此类。
如前所述,这绝不是对语言的“科学”测试。它最初只是为了营销而出现的。不过,也有一些小小的好处——使用同一种语言编写的编译器、操作系统和实用程序意味着您可以使用一种语言拥有完整的编程环境,从而极大地简化维护。 Unix 和 C 是“仅限 C”环境的第一个很好的例子。
Compilers are relatively complicated programs, so it is sometimes assumed that the ability to write something like a compiler is an indication that a computer language has enough power to write complicated programs -- i.e. a "true" programming language.
The compiler doesn't have to be written in the same language as it is compiling. For example, if C is used to write a Pascal compiler, it still fulfills the (somewhat non-scientific) test that C is a true programming language.
Obviously, for there to be a test, there has to be computer languages that are not powerful enough to write a compiler -- or that it may be so convoluted/complicated that it is not even attempted. Some 4GL, certain scripting languages, or specialized language (can you write a compiler in LISP? I dunno...) may fall into this category.
As mentioned, this is by no means a "scientific" test of a language. It originally came about only for marketing. There are some slight benefits though -- having a compiler, the O/S and utilities written in the same language means that you can have a complete programming environment in one single language, vastly simplifying maintenance. Unix and C is a good first example of a "C-only" environment.
这其实没什么意义。像这样的陈述不能真正应用于整个语言,而只能应用于它的特定实现。例如,C 编译器的代码很可能是用 C 编写的。
It doesn't really mean anything. Statements like that can't really be applied to a language as a whole, merely specific implementations of it. For instance, the code for a C compiler may well be written in C.
我建议“真实语言”的真实测试是它是否是图灵完备。解释性语言同样是真实语言,但是您不能用解释性语言编写解释器,这可能就是您的“一个人”所指的内容。 (实际上你可以,但是你需要原来的解释器来运行新的解释器,几代之后它会变得非常慢和大)。
I would suggest that the true test for "true language" would be whether it was Turing complete. Interpreted languages are no less true-languages, but you could not write the interpreter in the interpreted language, which may be what your "one guy" is referring to. (Actually you could, but you'd need the original interpreter present to run the new interpreter, several generations later it would be horribly slow and large).