David Langworthy, the Microsoft architect who owns The “Oslo” Modeling Language Specification, has these “Modeling in Text” videos HERE that walk through the specific process of creating a domain-specific language.
Intellipad
Working from his example we’ll compile grammar and transform the DSL into Xaml using PowerShell to read and create PS Custom Objects.
- I ‘embedded’ the DSL (lines 1-6)
- The DSL Grammar (lines 9-26)
- Called the M tool chain
- line 28 the M Compiler
- line 29 the MGrammar Executor
Then
- Read the Xaml file produced
- Converted it to an XmlDocument, line 31
- Looped through the entities in the graph
- And generated PowerShell Custom Objects
Finally
- Using PowerBoots line 38
- The DataGrid from the WPF Toolkit
- Displayed the results
From DSL => DynamicParser => Custom Objects => WPF data bound control
Using the M tool chain in this ways has it’s advantages in several scenarios. This script can easily be streamlined by checking file dates and bypass the m and mgx steps.
In future posts we’ll see if we can interact with the MGrammar namespace and work with Oslo in a deeper way.
{ 1 trackback }
{ 0 comments… add one now }