1 / 27

Building Textual Dsls With The "Oslo" Modeling Language

TL31. Building Textual Dsls With The "Oslo" Modeling Language.  Chris Anderson Engineer Microsoft Corporation.  Giovanni Della-Libera Development Lead Microsoft Corporation. What Is Oslo?. “M” The modeling language . “Quadrant” The modeling tool. Repository

emberlynn
Télécharger la présentation

Building Textual Dsls With The "Oslo" Modeling Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TL31 Building Textual Dsls With The "Oslo" Modeling Language  Chris Anderson Engineer Microsoft Corporation  Giovanni Della-Libera Development Lead Microsoft Corporation

  2. What Is Oslo? “M” The modeling language “Quadrant” The modeling tool Repository The store for models

  3. What Is "M"? A family of languages for manipulating data “MGrammar” Text to data “MGraph” Representing data “MSchema” Schematizing data

  4. The "M" Language DSL DSLX DSLY Point.m Domain Model DomainX.m Domain Model DomainY.m Domain Model PointLanguage.mg Domain Grammar DomainX.mg Domain Grammar DomainY.mg Domain Grammar "M" Domain-specific data models • type Point { • X : Integer; • Y : Integer; • } MSchema Domain-specific grammars • language PointLanguage { • syntax Main = h:Integer "," v:Integer • => Point { X { h }, Y { v }};} MGrammar Abstract data model • Point { X { 100 }, Y { 200 } } MGraph

  5. Let's Parse… Contact: giodl – 425-555-1212

  6. Mgrammar As Seen In Intellipad Input Grammar Output Text MGraph Transform Errors

  7. demo Defining A Language

  8. Processing Contact: giodl – 425-555-1212 Step 1: Tokenize

  9. Processing Contact: giodl – 425-555-1212 Tokens define the “words” of your language token Alias = ("A".."Z" | "a".."z")+;

  10. Processing Contact: giodl – 425-555-1212 Step 2: Parse

  11. Processing Contact: giodl – 425-555-1212 Syntax defines the “sentences” of your language syntax ContactEntry = "Contact" ":" alias:Alias "-" phone:Phone => Contact { Alias { alias } , Phone { phone } };

  12. Processing Contact: giodl – 425-555-1212 Remember interleave? interleave Ignorable = " " | "\n" | "\r“;

  13. Processing Contact: giodl – 425-555-1212 Shape the data… syntax ContactEntry = "Contact" ":" alias:Alias "-" phone:Phone => Contact { Alias { alias } , Phone { phone } };

  14. Processing Contact: giodl – 425-555-1212 Contact Alias Phone giodl 425-555-1212 syntax ContactEntry = "Contact" ":" alias:Alias "-" phone:Phone => Contact { Alias { alias } , Phone { phone } };

  15. Processing Contact Alias Phone giodl 425-555-1212 syntax ContactEntry = "Contact" ":" alias:Alias "-" phone:Phone => Contact { Alias { alias } , Phone { phone } };

  16. demo Advanced Topics

  17. Advanced MGrammar • Attributes • Case sensitivity @{CaseSensitive[false]} • valuesof() • Parameterized Rules syntax CommaList(Element) = ...;

  18. demo Using "MGrammar"

  19. Consuming MGrammar From CMD • MG.exe • MGrammar Image file (MGX) • MGX.exe • MGX + input file  output file (MGraph, XML, etc.)

  20. Consuming MGrammar From CLR • MG Build task • MGrammar Image file (MGX) • MGrammarCompiler • In memory version of MG Build task • DynamicParser • MGX + input stream  MGraph in memory • IGraphBuilder • MGraph “reader” and “builder”

  21. demo Something More Real…

  22. WIX Sample Language • Simple VB-esque language • ~50 lines of MGrammar • “Compiler” that generates WIX XML format • ~400 lines of C# • Walks the MGraph using IGraphBuilder • Uses a basic WIX object model in memory to generate XML • Standard WIX tool chain to generate MSI

  23. Summary • MGrammar • Language for creating textual DSLs • Specification will be released under OSP • Download the CTP Today! • http://msdn.microsoft.com/oslo • Build your own language! Please Send Feedback chrisan@microsoft.com | giodl@microsoft.com

  24. Q&A Please use the microphones provided

  25. Evals & Recordings Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com

  26. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related