This chapter is a basic introduction to metaprogramming. A metaprogram is a program that processes (i.e., takes as input or produces as output) programs. Metaprogramming is at the heart of software language implementation and processing. The processed programs or artifacts are also referred to as object programs. The language in which the metaprograms are written is referred to as the metalanguage. The language of the processed programs or artifacts is referred to as the object language. The following are all important scenarios of metaprogramming: interpretation, compilation, transformation, analysis, and code generation. In this chapter, we exercise several metaprogramming scenarios using Haskell as the metalanguage.
Unable to display preview. Download preview PDF.