I’ve just added a new webcast to
BloggersGuides.net, on an introduction to MGrammar. I have another one in the pipeline which I hope to get out next week that will look at a more real-world example of using MGrammar.
I found MGrammar confusing at first, and thought it would be one of the least used features of Oslo, but after having had the time to experiment with it a bit and get to know how it works I can think of a lot of scenarios where I will consider using it. At the MVP summit I met up with a few of the other MVPs who were finding some very creative uses for MGrammar.
So it seems you don’t need to have a big gray beard to develop a programming language anymore...
If you want to try it at home, here is the input...
|
Alan will do a presentation on Dublin at 16:00.
Johan will do a demo of Oslo at 17:00.
Dag will do a lab on Azure at 18:00.
|
And here is the MGrammar...
|
module BloggersGuides.Demos
{
language DemoLang
{
syntax Main = Session+;
syntax Session =
name:NameToken "will do a"
type:SessionTypeToken
OnOfToken
subject:SubjectToken "at"
time:TimeToken "."
=> Session { name, subject, time, type };
token OnOfToken = "on" | "of";
token NameToken = ('A'..'Z' | 'a'..'z')+;
token SessionTypeToken = "presentation" | "demo" | "lab";
token SubjectToken = ('A'..'Z' | 'a'..'z' | '0'..'9')+;
token TimeToken = (
"00" | "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" |
"10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" |
"20" | "21" | "22" | "23"
) ':' '0'..'5' '0'..'9';
interleave Whitespace = " " | "\r" | "\n";
}
}
|
Have fun!