What are the lengths/limits C preprocessor as a language creation tool? Where can I learn more about
Posted
by Weston C
on Stack Overflow
See other posts from Stack Overflow
or by Weston C
Published on 2010-05-06T21:44:04Z
Indexed on
2010/05/06
21:48 UTC
Read the original article
Hit count: 246
In his FAQ @ http://www2.research.att.com/~bs/bs_faq.html#bootstrapping, Bjarne Stroustrup says:
To build [Cfront, the first C++ compiler], I first used C to write a "C with Classes"-to-C preprocessor. "C with Classes" was a C dialect that became the immediate ancestor to C++... I then wrote the first version of Cfront in "C with Classes".
When I read this, it piqued my interest in the C preprocessor. I'd seen its macro capabilities as suitable for simplifying common expressions but hadn't thought about its ability to significantly add to syntax and semantics on the level that I imagine bringing classes to C took.
So now I have a couple of questions on my mind:
1) Are there other examples of this approach to bootstrapping a language off of C?
2) Is the source to Stroustrup's original work available anywhere?
3) Where could I learn more about the specifics of utilizing this technique?
4) What are the lengths/limits of that approach? Could one, say, create a set of preprocessor macros that let someone write in something significantly Lisp/Scheme like?
© Stack Overflow or respective owner