views:

99

answers:

4

I am not looking for frameworks or tools, but for advice how to get from a rough idea to a nice DSL.

A: 

There is a DSL book from Martin Fowler (not yet published).

deamon
+2  A: 

Martin Fowler's work-in-progress "Domain Specific Languages" includes a nice example in its introductory chapter (substantial parts of the book are available online). His related bliki page is also worth reading, and includes some links to other resources.

Among non-Fowler sources, Jeremy Miller's patterns and practices article "Internal Domain Specific Languages" is available on the web. (Ok, he's not exactly a non-Fowler source.)

Jeff Sternal
A: 

My advice would be to start with an internal DSL vs. an external DSL. Languages such as Lisp and Ruby make it easy to create internal DSLs. The advantage of starting with an internal DSL is you don't have to worry about parsing. Its quick and easy.

Another language that makes it very easy to create a DSL is TCL. Everything is a string! If you use tclkit then you can wrap the entire DSL + TCL into one single executable and ship that everywhere.

Sid H
+1  A: 

Yours is a rather open-ended question---but it's a very interesting one. Generally speaking, you will want to think not only about the application field, but also about the properties you want to enforce on your design.

There's been good academic work on this topic, hopefully the following papers can get you started:

  • "From a Program Family to a Domain-Specific Language" is an attempt at shedding light on the DSL design process. It's the first article that came to mind when I read your question, with the two following ones coming up related.
  • for a high-level overview of DSLs, try "DSLs: the good, the bad, and the ugly", an paper in the Conference on Object Oriented Programming Systems Languages and Applications;
  • "A Generative Programming Approach To Developing DSL Compilers" gets you from a high-level specification to a DSL. The article provides a methodology to develop DSL compilers, based on generative programming tools, as well as a case study.

Hope this helps!

Florent