DSLs

Posted by Warner Onstine on November 27, 2006

I’ve been interested in languages ever since I was little and I first learned how to read. I’ve taken French in High School and German in college, I just love being able to find similarities and difference in languages (one of the reasons I’m toying with taking some linguistics classes for my upper-division credits). I also really love programming languages, for some reason I actually bought a book on Modula-2 just based on an article I read on Dr. Dobb’s Journal waaaay back when. In my short time as a programmer I’ve looked at PostScript, Objective-C, Smalltalk (just a little), Java, C, Ruby, Groovy, etc. if it seemed at all interesting I picked it up and shook it to see what fell out.

This summer I went to NFJS (No Fluff Just Stuff) in Phoenix and got to hear Neal Ford talk about Domain Specific Languages (DSLs for short). He went through a number of examples of how to do a DSL inside of a language like Ruby, or Java and also talked about Lisp and how after a time you rose above the language and were in a domain-space.

I listened to this raptly and began to understand where some of my earlier research had led me. A few years ago I picked up a book called Generative Programming, which actually talked about some of the same technologies that Neal was talking about now. Of course to me alot of the book was over my head, but still very interesting. I think that we are now in this space, there is no magic bullet to solve every project, and if the domain is big enough you should be writing something “in that domain” not in Java, Struts, Tapestry, etc. Those are the tools you use when you deploy, but not when you write an app for your domain.

This is what RoR gets, this is what RoR is about, it is about a tool that will help you build an app for a domain. I think in the next year or so we are going to see alot of DSLs pop up that work on very specific domains, or allow you to tweak, and add-on to change for your domain.

Share and Enjoy:
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • Twitter
  • Facebook
  • Google Bookmarks
  • DZone

More Parsing Fun 1

Posted by Warner Onstine on November 27, 2006

Since I’ve started thinking about DSLs I’ve picked up another book on my bookshelf Building Parsers with Java and leafing through it looking at how to actually build up a variety of languages using Java. As I was browsing through my Groovy user list I came upon a link to an active Java Parser called JParsec.

JParsec definitely looks interesting and they even have a Groovy extension that looks pretty slick.

Another interesting item that showed up in the Building Parsers book has to do with how he splits up language types. He defines them in the following way:

  • Data language – this language is one that when parsed creates objects. Should be familiar to most, essentially most XML documents can be parked right here, or any kind of configuration like YAML.
  • Logic language – this language that when parsed executes logic statements, helps to define the relationship between objects, such as business rules. Languages like Curry fall in this camp.
  • Query language – this language provides the ability to query some kind of store, includes SQL, XPath, XQuery, etc.
  • Expression language – this language consists of values, variables, operators and functions (often in a small and concise manner) that when executed yields a result. Regex and OGNL fall into this camp.
  • Imperative language – A full blown language like Ruby or Java
  • Engines – These are used by query and logic languages to interface with the data store or look through a variety of values and rules that might be needed by the logic language to execute its statements.
Share and Enjoy:
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • Twitter
  • Facebook
  • Google Bookmarks
  • DZone

Easy AdSense by Unreal