Today, when developers want to create a new way to describe a domain, such as all of the attributes of a contact, they use XML, which forces the developer to tolerate a lot of angle brackets. Developers are willing to live with it, because creating a new parser is fairly challenging. The new MGrammar (Mg) from Microsoft promises a new alternative for developers.
As Microsoft was working on the new Oslo modeling environment, they started toying around with a tool for automatically parsing text into a database. However, once customers began to hear about it, the excitement began to build, and Microsoft decided to roll this out as the Mg component of Oslo, which was made available at last fall's PDC.
Developers are finding that Mg is not just another parser. James Clark noted in his modeling blog that while he has always found parsers to be a pain, Mg works differently in that it is purely declarative. It does this by constructing a labeled tree that represents the result of the parse. It also works more dynamically than a typical parser.
Mg is a functional transformation language for turning text into data. It complements the other Oslo components MSchema for schematizing data, and MGraph for representing data.
With MGrammar you start with a language declaration. For example, if you were coming up with a domain specific language for specifying customers and orders, you would create a
Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to keep you informed on recent service-oriented architecture (SOA) and SOA-related topics such as integration, governance, Web services, Cloud and more.
Hannah Smalltree, Editorial DirectorPaul Vick, who recently moved to the Mg team from the Visual Studio team at Microsoft said, moving to M Grammar may not be that big of a move. The grammar is designed to build languages, he said. In his words, it covers, not the whole end-to-end experience of a programming language, "but just the front end syntactical aspects."
To get started, developers need to download the Oslo CTP from the MSDN Website. It includes the Intellipad Text editor tool, although any text editor can be used to create Mg files. The document, "M Grammar in a Nutshell,"shows all of the steps needed to get up to speed on Mg. It includes language specifications that let you review the language constructs that are available.
Links:
MGrammar Presentation-PDC 2009
Getting Started with "MGrammar" (video)- Informit.com
The "Oslo" Modeling Language: "MGrammar" with Paul Vick (video)- Informit.com
Modeling Language Team Blog- MSDN.com
"MGrammar in a Nutshell"-MSDN.com
This was first published in February 2009