Search Wiki:
Lab enabling the beginners to learn how to use the DSL tools in one day.


Objective of this Lab.
The objective of this Lab is to create a specialized language by using the domain-specific language (DSL) Tools, and to customize it by using code that is based on the Visual Studio SDK. The DSL Tools are especially beneficial when you want to create a vertical language that is suitable for your business, and from the models that the language manipulates, generate the code for your business Framework. Nevertheless, because it is difficult to ensure that everyone who takes this training knows the professional tasks that are addressed by the targeted business Framework, we will settle for a horizontal (that is, technical) DSL that lets us learn how to use different aspects of DSL Tools.

As an example, with the DSL for state machines that you'll create, you'll be able to express the creation of a Line, taking into account the creation from the center and one extremity rather than from both extremities when the user presses the 'C' key:
StateMachineSample.jpg


In addition to providing training, this document also shows an approach to DSL design.

Prerequisites
Before you start this Lab, ensure that Visual Studio 2008 SDK 1.1 is installed on your computer. This can be downloaded for free from http://msdn.com/vsx

In addition, to simplify the creation of your code generators, download and install a T4 editor from http://www.t4editor.net/. A T4 editor provides syntactic coloring to aid in the editing of your T4 templates, including IntelliSense for the professional version of it.

Overview
The approach adopted in this Lab is the following:

#Creation of a DSL from an “Empty” DSL model. (45 steps: this chapter)

#Creation of a metamodel for finite-state automata: this metamodel includes the StateMachine, State, and Transition concepts. For now we will assume that the states do not have substates (27 steps).

#Specification of graphical notation with our DSL (51 steps).

#Test of our DSL in the test version of Visual Studio.

#Improvement of the MMI of the DSL.

#Addition of consistency rules to the model.

#Addition of validation rules to the model.

#Creation of a code generator that targets a Framework for implementation of finite-state automata.

#Test of our DSL on a few amusing examples.

#Addition of a setup to distribute our DSL.

The text for the Lab is available in thedowload tab
Last edited Nov 10 2008 at 8:29 PM  by jmprieur, version 4
Comments
planetpallavi wrote  Mar 17 at 6:26 AM  
Hey Jean,
Gr8 labs !!! When are the "Advanced DSL Tools" labs comin out as mentioned in lab 6 of above??
Waiting for them

Tim_Fischer wrote  Apr 30 at 8:57 PM  
You may also want to learn more about T4 Text Templates here:

http://tinyurl.com/T4-How-Do-I

Updating...
Page view tracker