Defining good DSL syntax is difficult; you need to understand what problems you want to solve (and which ones you do not, otherwise it ends up with everything in it, including the kitchen sink), and you need to figure out how to translate it into the target language (or interpret it on the fly) .
In both cases, you need a parser, and the interesting DSL syntax usually makes no sense to parse with regular expressions. So you need a real parser generator. If you're going to do something like Ruby, you'll need a strong parser!
Then you need to fix the result of the analysis as some data structure, usually a tree. Then you need to analyze your DSL code for special cases, optimize and determine how to generate the code. All this means that the parser is usually not enough. See My extended discussion Life after Parsing .
source share