Building a DSL in Clojure seems easy enough with multimethods, but there's still some room for improvement for common enough patterns.
Diesel aims to be a light weight DSL engine, so you can quickly describe a DSL with a nifty table of contents, but still take advantage of the multimethod infrastructure set forth by clojure.
For a nice introduction to building DSLs with Multimethods in Clojure, take a look at this blog post that inspired me to create Diesel on top of multimethods.
Currently Diesel provides small, but useful improvement over above:
- Centralized DSL operator definition
- The ability to support custom functions to dispatch on
- Default constant handling
- Default unknown operator handling
In your project.clj add
[com.onekingslane.danger/diesel "1.1.0"]
Currently there is an example usage here and the example illustrated by the afore mentioned blog post is implemented here:
Copyright © 2013 One Kings Lane
Distributed under the Eclipse Public License, the same as Clojure.