an evening of dsls: microsoft oslo

14
An Evening of DSLs: ‘Oslo’ James Lynch

Upload: james-lynch

Post on 01-Jul-2015

1.350 views

Category:

Technology


0 download

DESCRIPTION

It could be argued that the most valuable aspect of Microsoft’s ‘Oslo’ framework is the tooling it provides to create external DSLs. This talk will cover the basics of what is required to create and implement a DSL using Oslo.

TRANSCRIPT

Page 1: An Evening Of DSLs: Microsoft Oslo

An Evening of DSLs: ‘Oslo’James Lynch

Page 2: An Evening Of DSLs: Microsoft Oslo

What is Microsoft ‘Oslo’?

Difficult to define

Connecting Visual and Textual DSLs and SQL Server on the stack

Questionable merits/benefits

An immature technology – ‘nascent’ (3rd CTP)

Page 3: An Evening Of DSLs: Microsoft Oslo
Page 4: An Evening Of DSLs: Microsoft Oslo

An ‘Oslo’ Use Case:<plug>bdUnit</plug>

Page 5: An Evening Of DSLs: Microsoft Oslo

What is Microsoft ‘Oslo’?

Create a new language, parser and compiler…

BDD Style DSL with C# Unit Tests output

WPF IDE

Agnostic Unit Tests -> Structure Map to the Rescue!

Page 6: An Evening Of DSLs: Microsoft Oslo

bdUnit IDE Demo

Page 7: An Evening Of DSLs: Microsoft Oslo

The Parser: MGrammar

Page 8: An Evening Of DSLs: Microsoft Oslo

MGrammar and Intellipad

Intellipad

Tokens and Syntaxes

Language Projection(verb, noun, adjective...?)

Syntax Delegation

Functional Expressions

Page 9: An Evening Of DSLs: Microsoft Oslo

Intellipad Demo

Page 10: An Evening Of DSLs: Microsoft Oslo

Low Level Projection

When a @User(Chris) ~Username is "chriscanal"

and a @Post(DSLs) ~Title is "An Evening of DSLs"

and @Blog(ScotAltNet) ~Author is Chris

and @User(Chris) #Publish a @Post(DSLs)

@Blog(ScotAltNet) should have more than 0 ~Entries

and @Blog(ScotAltNet) ~Entries should contain a @Postwith DSLs ~Title

and @Post(DSLs) ~PublicationDate should be later than@Blog(ScotAltNet) ~CreatedDate

and @User(Chris) ~PostCount should be equal to 1

Object/Entity Token

Property Token

Method Token

Constraint Token

Operator Syntax

Value Syntax

Page 11: An Evening Of DSLs: Microsoft Oslo

Projection at a Higher Level

When a @User(Chris) ~Username is "chriscanal"

and a @Post(DSLs) ~Title is "An Evening of DSLs"

and @Blog(ScotAltNet) ~Author is Chris

and @User(Chris) #Publish a @Post(DSLs)

@Blog(ScotAltNet) should have more than 0 ~Entries

and @Blog(ScotAltNet) ~Entries should contain a @Postwith DSLs ~Title

and @Post(DSLs) ~PublicationDate should be later than@Blog(ScotAltNet) ~CreatedDate

and @User(Chris) ~PostCount should be equal to 1

WhenStatementSyntax

TargetList Syntax

Constraint Syntax

Page 12: An Evening Of DSLs: Microsoft Oslo

Textual DSL Pipeline

Page 13: An Evening Of DSLs: Microsoft Oslo

DSL InputParser

(MGrammar)Output

(MGraph)

Deserialization(AST Mappping)

Code GenerationOutput

(C# Unit Tests)

‘Oslo’ DSL Pipeline

‘M’ Language Framework and Tooling

You’re on your own!

Page 14: An Evening Of DSLs: Microsoft Oslo

bdUnit Project: http://assembla.com/spaces/bdunit

Email: [email protected]

Twitter: lynchjames

Blog: http://lynchjames.co.uk