C/C++ 编译器如何工作?

经过十多年的 C/C++ 编码,我注意到以下模式 - 非常优秀的程序员往往对编译器的内部有详细的了解.

After over a decade of C/C++ coding, I've noticed the following pattern - very good programmers tend to have detailed knowledge of the innards of the compiler.

我是一个相当优秀的程序员,我有一个特别的编译器迷信"集合,所以我想重新认识我的知识并从基础开始.

I'm a reasonably good programmer, and I have an ad-hoc collection of compiler "superstitions", so I'd like to reboot my knowledge and start from the basics.

谁能推荐在线资源或喜爱书籍的链接?我对 C/C++ 编译、优化、GCC 和 LLVM 特别感兴趣.

Can anyone recommend links to online resources or favorite books? I'm particularly interested in C/C++ compiling, optimization, GCC and LLVM.

推荐答案

从龙书入手....(更注重代码优化和代码生成)

Start with the dragon book....(stress more on code optimization and code generation)

继续为诸如 Decaf 或 Cool 之类的教育编程语言编写一个玩具编译器,您可以在前端使用解析器生成器(lex 和 yacc)(让生活更轻松并专注于更多 imp 的东西)....

Go onto write a toy compiler for an educational programming language like Decaf or Cool.., you may use parser generators (lex and yacc) for your front end(to make life easier and focus on more imp stuff)....

然后阅读 gcc 内部书以及浏览 gcc 源代码.

Then read gcc internals book along with browsing gcc source code.

相关文章