问题描述
如何以与语言相同的语言编写一个编译器编写该编译器?
:这可能会被删除,但是...:
如何引导:
为什么引导:
通常第一个版本的编译器是用不同的语言编写的,然后每个后续版本都用该语言编写,并用旧版本编译。一旦你使用版本 x-1
编译版本 x
,就可以使用新构建的版本 x
重新编译自身,利用版本引入的任何新的优化; GCC以这种方式发布
How can you write a compiler in the same language as the language you're writing that compiler for? Isn't that sort of recursive?
Edit:This may be deleted, but otherwise... :
How to bootstrap:
Why to bootstrap:
Generally the first version of the compiler is written in a different language, and then each subsequent version is written in that language and compiled with the older version. Once you've compiled version x
with version x-1
, you can use the newly built version x
to recompile itself, taking advantage of any new optimizations that version introduces; GCC does its releases that way
这篇关于一个语言的编译器如何用这种语言编写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!