If you're trying to build a external DSL, you'll need to write a compiler for it. If the language is non-trivial, you will probably want to use a parser generator. One of the best is SableCC, which deserves to be better known.
Nat Pryce (of JMock and OO-Matron fame) has written an excellent introduction to SableCC version 3.
I've been using v2 of SableCC for a couple of years to compile the DSL for the SmartRec project.
At the time I started work on SmartRec, v3 of SableCC was still unstable and the documentation was minimal. I decided to stick with V2, which was recommended for production applications.
I got off to a very quick start. Sadly, as the DSL got more sophisiticated my compiler got more brittle. I've been looking for a good solution for a while. Nat's article has given me one. Thanks, Nat!
No comments:
Post a Comment