Implementing a C preprocessor
Much has been written over the years on implementing pars开发者_开发技巧ers, but the C preprocessor is not quite the same as any of the stages of a typical parser, and implementation thereof doubtless has its share of particular pitfalls to watch out for. Does anyone know of anything written on the topic of implementing a C preprocessor?
Hartmut Kaiser, the author of Boost Wave, wrote a nice article on CodeProject http://www.codeproject.com/KB/recipes/wave_preprocessor.aspx about the Boost Wave project. You can use Boost Wave to make your own C preprocessor with custom extensions.
I found a useful discussion in the document mcpp-summary at http://mcpp.sourceforge.net/
I've based mine on the gnu internals
精彩评论