About Me

I am a computer programmer. I do programming professionally and for a laugh.

Technical stuff on programming, java, DSLs, etc...

Tuesday 30 March 2010

Another DSL Framework

When I joined Thoughtworks back in 2005, the hottest subject was domain specific languages(DSLs).

Martin Fowler wrote about them, a few people in TW developed a few projects with nice DSLs in Ruby and intellij people was developing an ide for crafting your dsl and tools to go with it.

So I took interest not to miss on pub chat. I have had a look at a few of the tools, like antlr and javacc, that one can develop a dsl. They are not easy to work with. You define your language in a BNF format in a text file and then there is a compiler to convert your language to a model and lots of other things you need to do to get a language.

So I did what any real geek would do; I have written a compiler compiler. It is called Language Processor. A software that you can feed in a language definition with its semantic and you get an object that can run your program in your defined language.

The trick is that everything stays in Java. No external files definitions etc. Define your syntax, semantic everyhing and run it all in Java.

I have never found it in me to opensource it. The project has been parked for some years now. My original cunning plan was to also develop an eclipse plug-in to go with your defined language. So you develop a DSL, the plug-in would automagically provide an editor that support syntax highlighting, code completion, outline view build support, run support etc. It is a big task. I have programmed some of it but now I feel like might take a while with 1 hour max to spare between day job and various domestic duties. Besides some clever people with more time in their hands had already came up with a similar thing:- Xtext

So here we are, I am open-sourcing the DSL generator. Productionizing is an important feature anyway eh? It is here: http://sourceforge.net/projects/languageprocess/  You can dowload the eclipse project or check-out the code. Below is a brief tutorial to show what can be done with it.

tutorial 1, 2, 3

My dear friend Shaun Smith once promised to write a logo language like tortoise pen in Language Processor and a tutorial of how to. He is very welcome anytime.

Feel free to nick the entire project or parts of the code. Drop me a note if you use it for something useful.

2 comments:

  1. Hi,
    This is really looks good, could you please share the sample example and tutorial.

    Thanks,
    Sai

    ReplyDelete
  2. Hi Sai, the next 3 blogs posts has a sample, also if you check the project out from sourceforge, it has a few samples. Thanks...

    ReplyDelete

Followers