Writing programs that write other programs, also called "metaprogramming" or simply "code generation", is a useful technique in generating specialized and optimized code:
SymbolicC can create domain-specific languages in Mathematica and translate them to C. This example defines a simple language that converts Mathematica points and polygons into calls to the OpenGL API: