Oslo MGrammar : @{CaseSensitive[false]} or @{CaseInsensitive}?
I wrote a small MGrammar for creating my own DSL and all I wanted to do was to make my DSL a Case Insensitive one. I thought this would be an easy task with the CaseSensitive attribute that I found in the MGrammar Language Specification Document that gets installed when you install the Oslo SDK. But when I used the attribute in my grammar, it just didn't work! Being a nascent technology, I couldn’t find much help on the web, but when I went through the Release Notes of the Oslo SDK Jan 2009 CTP, I could find a section for breaking changes, where I could find the fix for this problem. In fact MS has renamed the attribute to CaseInsensitive. It was just that the MGrammar Language Specification document had not been updated (don't know how could they miss this!) to reflect the same. CaseSensitive attribute was part of the earlier MGrammar specification.
So now if you want to make your DSL case insensitive you can decorate your language with the @{CaseInsensitive} attribute as shown below:
module HelloWorld {
@{CaseInsensitive}
language HelloWorldLanguage {
syntax Main
= Hello World;
token Hello
= "Hello";
token World
= "World";
interleave Whitespace
= " ";
}
}
The above language doesn't just recognize "Hello World", but also recognizes "hELLO WoRLD", "HELLO world", "HeLLo wORlD" etc.


