是gcc C编译器C语言编写的本身呢? [英] Is gcc C compiler written in C itself?

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

问题描述

是用C本身GCC C编译器?抑或是写在大会?如果编译器是用C写的,那么什么是用于编译,编译器code编译器?

Is gcc C compiler written in C itself ? Or is it written in Assembly ? If the compiler is written in C, then what is the compiler used to compile the compiler code ?

推荐答案

具体的历史GCC在 GCC维基。更普遍的观点是,编译器通常最初与其他一些编译器编译,直到他们有足够强大的编译自己。或者,也可以编写一个基本的编译器,可以处理的汇编的功能的子集,并从那里建立。但同样,这是几乎从来不再需要。有大量的编译器可在各种​​语言。即使斯蒂芬·约翰逊写的PCC(第一个C语言编译器中的一个),有可用的编译器B,与许多其他语言一起。 GCC有几个编译器从最初以建立它来挑去,和RMS说,他使用至少他最初的发展过程中Pascal编译器。

The specific history to gcc is given at the GCC Wiki. The more general point is that compilers are generally originally compiled with some other compiler until they are powerful enough to compile themselves. Alternately, it is possible to write a basic compiler that can handle a subset of your features in assembler, and build up from there. But again, this is almost never needed anymore. There are plenty of compilers available, in a variety of languages. Even when Stephen Johnson was writing pcc (one of the first C compilers), there were compilers for B available, along with many other languages. gcc had several compilers to pick from to build it originally, and RMS says he was using the Pastel compiler at least during his initial development.

记住,没有一个C编译器将C语言编写的,如果你想你可以把它写在Perl的要求。没有对于给定的平台的编译器进行最初写入在该平台(嵌入式系统几乎总是被某些其他的系统上编译)的要求。因此,有很多方法可以让自己的自举。

Remember, there is no requirement that a C compiler be written in C. You could write it in Perl if you wanted to. There is no requirement that a compiler for a given platform be originally written on that platform (embedded systems almost always are compiled on some other system). So there are many ways to get yourself bootstrapped.

这问题有相关的自举编译器的第一个实例一些有趣的微妙之处。如果你很聪明,你可以利用的引导做不可思议的事,辉煌和恐怖

This question has some interesting subtleties related to the first instance of bootstrapping the compiler. If you were very clever, you could make use of that bootstrap to do something incredible, brilliant and terrifying.

这篇关于是gcc C编译器C语言编写的本身呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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