Wednesday, October 29, 2008 6:36 AM
hoop
Creating and editing MGrammar files with Intellipad
[Update: Thanks to everyone who pointed out that the originally described method for setting the mode to MGrammar doesn't work in the PDC build of Intellipad.]
[Update 2: clarifying some things about using tree preview.]
One of the cool features in Intellipad is its support for creating custom DSLs using the MGrammar language. In the PDC release of the "Oslo" SDK, the MGrammar language services are shipped as part of the Intellipad samples. The goal of this post is to get folks started down that path.
Getting MGrammar support in Intellipad
To launch Intellipad with the sample plug-ins loaded, you either select the "Intellipad (Samples Enabled)" item when launching it from the start menu or pass it a startup configuration file that includes the samples directory (startup config files are specified using the /c option). An example would be: ipad.exe /c: ipad-vs-samples.xaml
In the future, the MGrammar Language support will not require loading with samples.
Creating your DSL
Once your buffer is in MGrammar mode, You should get a new top-level menu-item allowing you to access MGrammar specific commands. Now you're free to begin entering MGrammar code, as you do this, one of the really nice features Intellipad gives you is live parsing of a file via the Tree Preview. If you create and save a file written in your grammar, you can use the Tree Preview mode to see the results of your grammar as it is parsed.
You enter "Tree Preview Mode" by selecting Tree Preview from the MGrammar Mode menu.
You will then get an Open dialog prompting you to provide an input file for your grammar:
This will result in a layout in Intellipad similar to what you see here:
The errors window at the bottom will give you feedback about errors encountered while parsing the input file. You also get red squiggles:
Similarly, if there's an error in your grammar, the errors window tells you about it and gives you squiggles in the grammar.
