This is even a major feature of Visual Studio 2005 and above.
Typically these are things like Ruby on Rails which is essentially a DSL for creating dynamic websites quickly.
However there is a much simpler solution.
State your problem in XML and use xslt to generate the solution.
If done carefully you can eliminate a lot of easy to write, but easy to get wrong code.
This is really what Kathleen Dollard has been talking about in her Code Generation in .net book.
Here is an example that almost all applications have to deal with:
How much work is it to add another maintenance screen to the system?
How much work is it to add one field to one maintenance screen?
If you get the principle working for one screen you can add another by adding a few lines to an xml document and regenerating the script.