Building specialized languages

A programming language is roughly made up of built-in procedures and functions, and of special forms. The built-in procedures and functions are typically for arithmetic, list manipulation, input/output, etc. Special forms make up the syntax of the language. Typical special forms are conditionals such as if, and loop constructs such as while and for.

In addition, most programming languages have a way of constructing new functions and procedures out of existing ones. These new procedures work like the built-in ones, except that in most languages the syntax is different. For instance, in C you could write a + b for applying the +function to a and b. However, if you write your own function, say f, you cannot write a + b. Instead, you have to write f(a, b).

In some cases, extensive libraries exist, where someone has created a collection of procedures and functions useful for some specific purpose, say graphics. Such libraries represent a way to customize the language to a particular class of applications. In other words, the language is transformed from a general-purpose one, to an application-specific language.

But, whether a language is convenient to use for a particular class of applications depends both on the procedures and functions (whether built-in or in libraries), and the special forms. Unfortunately, most languages do not allow the user to create new special forms out of existing ones.

Common Lisp allows the user to extend the language both with procedures and functions, and with special forms. This feature makes it possible to transform Common Lisp to an application-specific language in all possible respects.