1.3. Metaprogramming in the Host LanguageYACC is an example of a translatora metaprogram whose domain language differs from its host language. A more interesting form of metaprogramming is available in languages such as Scheme [SS75]. The Scheme metaprogrammer defines her domain language as a subset of the legal programs in Scheme itself, and the metaprogram executes in the same translation step used to process the rest of the user's program. Programmers move between ordinary programming, metaprogramming, and writing in the domain language, often without being aware of the transition, and they are able to seamlessly combine multiple domains in the same system. Amazingly, if you have a C++ compiler, this is precisely the kind of metaprogramming power you hold in your fingertips. The rest of this book is about unlocking that power and showing how and when to use it. ![]() |