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: 220

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

Related posts about c

    Related posts about cpp

    • encfs error while decoding the data

      as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
      I have installed encfs and started using it to secure all my personal & office data and it was working absolutely fine until 2 hours back. The setup is like this. I have a folder in Copy folder called OfficeData which gets synchronized with my Copy folder When I login into the system I use… >>> More

    • Use synergy with Physical KVM

      as seen on Super User - Search for 'Super User'
      I am using synergy on a Linux Mint computer as the server with a Mac as the client. I also have a physical KVM switch. The problem I have is that when ever I switch the physical KVM to my Mac, synergy stops working as in the keyboard and mouse don't work with the Mac. Thanks in advance! EDIT:… >>> More

    • Qt Linking Error.

      as seen on Stack Overflow - Search for 'Stack Overflow'
      Hi, I configure qt-x11 with following options ./configure -prefix /iTalk/qtx11 -prefix-install -bindir /iTalk/qtx11-install/bin -libdir /iTalk/qtx11-install/lib -docdir /iTalk/qtx11-install/doc -headerdir /iTalk/qtx11-install/include -datadir /iTalk/qtx11-install/data -examplesdir /iTalk/qtx11-install/examples… >>> More

    • Compiling OpenCV in Android NDK

      as seen on Stack Overflow - Search for 'Stack Overflow'
      PLEASE SEE THE ADDITIONS AT THE BOTTOM! The first problem is solved in Linux, not under Windows and Cygwin yet, but there is a new problem. Please see below! I am currently trying to compile OpenCV for Android NDK so that I can use it in my apps. For this I tried to follow this guide: http://www… >>> More

    • A Linker Resolution Problem in a C++ Program

      as seen on Stack Overflow - Search for 'Stack Overflow'
      We have two source files, a.cpp and b.cpp and a header file named constructions.h. We define a simple C++ class with the same name (class M, for instance) in each source file, respectively. The file a.cpp looks like this: #include "iostream" #include "constructions.h" class M { int … >>> More