How you can learn M Grammar for Oslo modeling

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

    Requires Free Membership to View

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 language declaration and specify the syntactic parts of those languages. Mg will generate a set of .Net source code that will produce a component that defines a lexicon to tokenize the input. Then the developer can use the tokens to format a higher level syntax. Each unit of syntax is called a production.

Paul 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.


This was first published in February 2009

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.