How do C/C++ compilers work?

后端 未结 10 1693
旧时难觅i
旧时难觅i 2020-12-12 13:02

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\'

10条回答
  •  忘掉有多难
    2020-12-12 13:42

    As noted by Pete Eddy, Jack Crenshaw's tutorial is excellent for newbies. But if you want to see how to a real, production C compiler works—one which was designed by brilliant engineers instead of created by throwing code at the wall until something stuck—get yourself a copy of Fraser and Hanson's A Retargetable C Compiler: Design and Implementation, which contains the source code to the very clean lcc compiler. Explanations of the design and implementation are mixed in with the code. It is not a first book for a beginner, but it will repay careful study, and you can get a used copy for $35.

    For a longer blurb about lcc, see Compile C Faster on Linux.

    The lcc web page also has links to a number of good textbooks. I don't know of an intro text that I really like, however.

    P.S. Sorry you got ripped off at Uni.

提交回复
热议问题