A beginner’s view – Textual DSL with OSLO

For just over a month I have been working on a project at work that lets users select inventory items from a database using a textual DSL. This is the first DSL I have ever produced! I thought that it was interesting that with no significant experience in building DSLs I was able to produce a useful application in a relatively short period of time. Below are the best resources I found and a few remarks:


Overview/Perspective: The Herding Code interview with Markus Völter (who you might know from Software Engineering Radio) is interesting – while not strictly focused on textual DSLs he gives a great overview/critique of Microsoft’s OSLO effort and interesting information on the Eclipse tools in this space (some recent news related to topics in the interview from Douglas Purdy and a short post by Markus). If you want to see some of the Eclipse tools he mentions the second link will take you to a nice presentation.

Useful MGrammar/OSLO focused podcast: This podcast features Shawn Wildermuth and has some great discussion around DSLs with a focus on OSLO:

Bits and samples: The Oslo Developer Center – official downloads and samples (I thought the MGrammar samples were good study material):

Focused start: This three part series by Shawn Wildermuth was incredibly valuable because the focus of the articles matched what I was trying to accomplish quite well:

Digging deeper: There is a good chance that you will need to dig into some of the details of MGraph and MGrammar – I found the following references useful:

Skeptical? The application I developed is currently being tested by a handful of users, so far these are the points I would make in support of the DSL:

  • Less dev time than you might guess: this is a small business app with a tight focus, it was coded by one dev working part-time on the app in about 4 weeks. There are always more features to implement, but the app is useful now with a fairly low investment.
  • Powerful/Flexible Searching: For advanced users the DSL exposes many more search fields/categories/options than I know how to expose via a reasonable list/wizard/combo box/text box style query build screen, and it is not nearly as tedious! The textual interface allows advanced users to be more efficient and creative and gives them access to more options than they had in the past.
  • Conventional UI feeds the DSL: I found the ‘conventional’ query build screen to be fast and pleasant to develop because it simply constructs the text to be parsed! This means that anything I build for the conventional interface needs to be supported by the DSL – this forces all features to remain ‘exposed’ in the textual interface for more advanced users.

Pain points:

  • I was surprised by the amount of work that I had to to to turn the AST produced by parsing the user’s input into usable objects/actions. There are some samples/posts/ideas out that can help build objects automatically – but this seems like an obvious area for Microsoft to enhance since we are talking about an all MS tool chain. I imagine that most scenarios are going to involve walking the tree to build/modify objects? Is there an approach or scenario that really does not do that?
  • The lack of a text editor component to put in your application in conjunction with your DSL is disappointing. There is an obvious need to deliver an editor for your DSL embedded in your app with syntax highlighting and keyword completion, if that is currently available I am not aware of it… While inputting text into a vanilla textbox may be a good test of the simplicity and logic of your DSL I doubt it is really the user experience you want. If a commercial product is an option then Actipro’s WPF SyntaxEditor might be interesting – they have MGrammar support which sounds encouraging, but I have not made time to test it out.

While the jury is still out if the application mentioned in this post will be successful I think that it was the right choice to build and try a DSL – hopefully if you are interested in trying out a textual DSL in .NET the links and information above will be interesting!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s