Getting Started with Domain Specific Languages

I am just getting started with the DSL Toolkit. Admittedly, DSL has seemed like a black art, because it was hard to figure out all the interim releases and CTPs. The goal of this series of blogs is to walk you through my experience of learning to create DSLs using the Visual Studio 2005 SDK. This is also going to be a bit of an eye-opener for me, seeing how others try to wade through the Microsoft mass of information to find how to get started with a particular technology.

Installation

I found the Visual Studio 2005 SDK Version 4.0 online at https://www.microsoft.com/downloads/details.aspx?FamilyID=51A5C65B-C020-4E08-8AC0-3EB9C06996F4&displaylang=en. I installed it, everything ran like a champ.

Getting Started

True to form, I decide not to read any documentation; I go searching for SDK examples. I found the 4 examples that were installed on my harddrive at:

C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Samples\DSLTools

I was able to load up the examples, but when I hit F5… I got some cryptic error about "Can't start preprocessor (2)". Huh? I went searching, and eventually wound up at the MSDN Forums. I found a thread that mentions "can't start preprocessor" in the MSDN Forums for DSL Tools that mentioned a similar error that showed up in the November CTP. The solution there seemed to be that you need to have C++ installed for the DSL Toolkit to work. Argh. Found my MSDN disc for Visual Studio and installed C++.

DSL Tools Getting Started Tip #1: Make sure you have C++ installed as one of your languages for Visual Studio 2005

OK, that was resolved! I can now run and debug the existing samples. I tinkered with the Family Tree example for a little bit, trying to figure out what's going on. Pretty cool, it shows how to validate in the model. Then I try tinkering with some of the others… maybe its me, but I don't get what they are trying to convey yet.

Maybe looking through the samples is a little premature, let's see what I can do on my own without reading any docs first. I open Visual Studio 2005 (MAKE SURE TO RUN AS ADMINISTRATOR ON VISTA!!!), and choose New / Project / Extensibility / Domain-Specific Language Designer / Minimal Language and run through the wizard. A project called "DSL" is created, but the "DSL Package" and "Debugging" projects were not created. Instead, I receive an error when I try to create my own language… "The method or operation is not implemented." Argh! C'mon! OK, back to the forum. I stumble across a thread on the Domain Specific Languages Tools MSDN forum that lists problems similar to mine. I open the Visual Studio 2005 Command Prompt (MAKE SURE TO RUN AS ADMINISTRATOR ON VISTA!!!) I run:

Devenv.exe /setup

Maybe I opened Visual Studio 2005 a little too quickly or something, but I opened it up and it freaked on me. No templates were there for the New Project dialog. My stomach sank, thinking of the number of customer demos I have upcoming. Don't panic, just try it again. I ran it a second time and waited for awhile. Came back to the machine, and the templates were installed. However, still getting the same error, "The method or operation is not implemented." At the bottom of this thread, I see another hint to run:

Devenv.exe /resetSettings

DSL Tools Getting Started Tip #2: Don't bother searching Live.com or Google.com for answers. The MSDN Forum for Domain-Specific Languages Tools is where you should focus your energy on while troubleshooting.

Bingo! I can now create my own language, and can reliably run the samples in the SDK. Now to find a hands on lab, webcast, or screencast somewhere to shorten my learning curve in creating my first DSL.