当前位置:  开发笔记 > 编程语言 > 正文

What language do they build other languages with?

如何解决《Whatlanguagedotheybuildotherlanguageswith?》经验,为你挑选了3个好方法。

What language is used to build low level languages like c++ and java?

How could you build the first language with no language?



1> Greg Hewgill..:

In the context of compilers, this operation is often called bootstrapping. In particular, see the "Chicken and egg problem" section for a direct answer to your question.

The very first compiler would have been hand-written in assembly language. If your next question is "how was the first assembler written?" then the answer would be that the first assembler was hand-written in binary machine code, possibly with front panel toggle switches. This is undoubtedly a simplification of what really happened, but the concept is the same.

There is also an excellent article titled Reflections on Trusting Trust by Ken Thompson about the risks of using a compiler for a language to build the compiler for that language.



2> wj...:

You don't build a language, but you build a compiler or an interpreter ... and for this you can choose any language even the language you want to compile ...

The first self-hosting compiler — capable of compiling its own source code in a high-level language — was created for Lisp ... Since the 1970s it has become common practice to implement a compiler in the language it compiles, although both Pascal and C have been popular choices for implementation language. http://en.wikipedia.org/wiki/Compiler



3> S.Lott..:

Much of this kind of thing is done in C.

The first C compiler was not written in C; it was PDP-11 assembler. Other early C compilers have been written in various assembler languages.

But all subsequent C compilers actually are written in C, based on an early "Portable C Compiler". Yes, it's circular. But the version x compiler can be used to build the version x+1 compiler.

推荐阅读
k78283381
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有