Your question is quite well timed. I have recently written a DSL using the tool Antlr.
Antlr is a parser/lexer generator.
It allows easy construction of DSLs (and many other things) and when coupled with StringTemplate (written by the same person) becomes very powerful in code generation. It also can target multiple languages. Our parser and lexer is in C# (one of the targets) even though the default is Java.
One of the numerous benefits of Antlr are the descriptive error messages and the IDE/debugger (AntlrWorks) which allows you to step through your grammar and see the AST trees visually.
John Saunders suggested below the use of the built in visual studio DSL toolkit. Ultimately, I found those tools to be far to constricting. To require a GUI, without any ability to easily describe an underlying textual grammar, just seems inadequate for my needs.
Along with the DSL parser/lexer I have also written a Visual Studio Language service, to provide intellisense, error highlighting, code completion and template items/projects.
Even if you dont implement the extras, a DSL can simplify repetitive work. My DSL specifically targets the CSLA framework, generating business objects easily with all the plumbing, allowing the developers to only worry about business logic.
Here is a small example of the DSL:
datadef Object1Datadef
{
tables
{
MyTable:PK[MyTableID], column1, column2;
}
}
root MyObject
{
datadef Object1Datadef;
read "all";
write "admin", "superusers";
int _Myvariable;
}
If your DSL allows you to describe your domain faster, more easily and increases productivity, then it is worthwhile.