Friday, September 17, 2010

Groovy for DSL

I am fed up of XML being used for the wrong thing (thank you Ant, Maven and the rest)
so I want to be able to design my own DSL.
I have the strong feeling that if you manage to design a DSL you gain a tool of immense power.

I wrote some 25 years ago a C compiler in Lex and Yacc, to be able to generate embedded firmware in Z80 controller cards, and it was great fun.
These days we have more powerful tools, like Groovy.

I am reading this book and I find it fascinating:

https://www.packtpub.com/groovy-for-domain-specific-languages-dsl/book



This link http://docs.codehaus.org/display/GROOVY/Writing+Domain-Specific+Languages  is also very dense of information.

Some concepts:
Java is cool, but verbose.
Groovy DSL is used internally by Groovy to implement parts of the Groovy framework.
An XML document is a primitive form of DSL
A DSL is a programming tool designed for the domain expert

..... to be continued...

This is a practical example on how to develop a Groovy DSL in minutes:
http://groovy.dzone.com/news/groovy-dsl-scratch-2-hours


and here a good presentation on Groovy DSLs

No comments: