Concrete Syntax Definition for Modeling Languages

Sep 2, 2007 - 6 -. Model Driven Engineering. Model. Transformation. Target. Languages ... Application. Level. (project) ... Use small languages (DSL) ..... Object types ... Meta-CASE ... Meta-CASE. Diagram. White: M2. Grey: M1. ○ UML-DI.
1MB taille 4 téléchargements 371 vues
Concrete Syntax Definition for Modeling Languages Frédéric Fondement PhD. thesis Private Defense Swiss Federal Institute of Technology in Lausanne Software Engineering Laboratory September 2007

Contents z Introduction • Model Driven Engineering • Language Definition

z Concrete Syntaxes • Textual concrete syntax definition • Graphical concrete syntax definition

z Conclusions

© F. Fondement

-2-

September 2007

Im p

ro v em

en ts

Software Engineering Abstraction

System System System System System

Platform/s Specificities

• Test • Validation • Verification © F. Fondement

• Rq: Level of Abstraction ≠ Level of Detail -3-

September 2007

Model Driven Engineering

en ts

z AUTOMATION !

Transformation Transformation

Im p

Transformation

ro v em

Transformation

Code Generator

System System System System System

Model Model Model Model Model

Code Generation System

Code

• Test → GENERATION • Validation → PROTOTYPING • Verification → MODEL CHECKING © F. Fondement

-4-

September 2007

Model Driven Engineering

en ts

z AUTOMATION !

Transformation Transformation

Im p

Transformation

ro v em

Transformation

Code Generator

System System System System System

Model Model Model Model Model

Code Generation System

Code

• Test → GENERATION • Validation → PROTOTYPING • Verification → MODEL CHECKING © F. Fondement

-5-

September 2007

M2

Definition Level (method)

Model Driven Engineering

Source Languages (Metamodels)

Model Transformation

M1

Application Level (project)





m e t s eym S t s e y rc S u o S

© F. Fondement

Target Languages (Metamodels)

em t s m y te S s t y e gS Tar Set up @4537H Mov ah, up Int 4CH

-6-

September 2007

Domain Specific Modeling Research result z Use small languages (DSL) • Dedicated to a domain • Dedicated to a level of abstraction

In a software project z Multiple levels of abstraction z Different domains z Different human sentivities Proliferation of languages ! • Support for language engineering © F. Fondement

-7-

September 2007

Contents z Introduction • Model Driven Engineering • Language Definition

z Concrete Syntaxes • Textual concrete syntax definition • Graphical concrete syntax definition

z Conclusions

© F. Fondement

-8-

September 2007

Language Definition

Concepts

M2

Meaning

Language

Interface

© F. Fondement

-9-

September 2007

Concepts Definition

M2

Abstract Syntax

z M1 (sentence) is an AST/ASG • Graph of instances

ModelElement name : String

z Interface StateMachine source subvertex *

StateVertex

Event

outgoing

1

*

1

*

target

trigger 0..1 Transition

*

• E.g. Model Transformation • E.g. Model checker

incoming top 1 State

PseudoState

«enumeration» PseudoStateKind

kind : PseudoStateKind container 0..1

Composite State

© F. Fondement

Simple State

Final State

initial choice ...

- 10 -

September 2007

Interface Definition

M2

Abstract Syntax + Concrete Syntax(es) ModelElement name : String

StateMachine source subvertex *

StateVertex

Event

outgoing *

1

*

1 target

trigger 0..1 Transition

*

incoming top 1 State

PseudoState

«enumeration» PseudoStateKind

kind : PseudoStateKind container 0..1

Composite State

Simple State

Final State

initial choice ...

z Interface between concept instances and system architects • Mean to manipulate virtual concept instances • Different points of view, different approaches to visualization • Emphasize different details

© F. Fondement

- 11 -

September 2007

Interface Definition

M2

Abstract Syntax + Concrete Syntax(es) ModelElement name : String

StateMachine source subvertex *

StateVertex

Event

outgoing *

1

*

1 target

trigger 0..1 Transition

*

incoming top 1 State

PseudoState

«enumeration» PseudoStateKind

kind : PseudoStateKind container 0..1

Composite State

Simple State

Final State

initial choice ...

or

z Graphical: practical use • Layout constraints • User interactions

sm ::= "Statemachine" IDENT compositeState state ::= normalState | pseudostate normalState ::= "initial"? (simpleState | compositeState) simpleState ::= "State" IDENT compositeState ::= "CompositeState IDENT? LCURLYBRACKET (state | transition)* RCURLYBRACKET transition ::= "Transition" IDENT? "from" IDENT "to" IDENT ("on" IDENT)? pseudoState ::= "FinalState" IDENT | "Choice" IDENT

© F. Fondement

- 12 -

September 2007

Meaning Definition

M2

Abstract Syntax + Concrete Syntax(es) +

Semantics

ModelElement name : String

StateMachine source subvertex *

StateVertex

Event

outgoing *

1

*

1 target

trigger 0..1 Transition

*

incoming

SC MM

SC Interpreter

SC MM

SC Compiler

top 1 State

PseudoState

«enumeration» PseudoStateKind

kind : PseudoStateKind container 0..1

Composite State

Simple State

Final State

initial choice ...

SQL MM

z Research issue

or sm ::= "Statemachine" IDENT compositeState state ::= normalState | pseudostate normalState ::= "initial"? (simpleState | compositeState) simpleState ::= "State" IDENT compositeState ::= "CompositeState« (state | transition)* RCURLYBRACKET

IDENT? LCURLYBRACKET

transition ::= "Transition" IDENT? "from" IDENT "to" IDENT ("on" IDENT)? pseudoState ::= "FinalState" IDENT | "Choice" IDENT

© F. Fondement

- 13 -

September 2007

Language Definition

M2

Abstract Syntax + Concrete Syntax(es) +

Semantics

ModelElement name : String

StateMachine source subvertex *

StateVertex

Event

outgoing *

1

*

1 target

SC SC MM Interpreter

trigger 0..1 Transition

*

incoming top 1 State

PseudoState

«enumeration» PseudoStateKind

kind : PseudoStateKind container 0..1

Composite State

Simple State

Final State

SC MM

initial choice ...

SC Compiler

SQL MM

↑ Metamodel ??? → or sm ::= "Statemachine" IDENT compositeState

??? →

state ::= normalState | pseudostate normalState ::= "initial"? (simpleState | compositeState) simpleState ::= "State" IDENT compositeState ::= "CompositeState« (state | transition)* RCURLYBRACKET

IDENT? LCURLYBRACKET

transition ::= "Transition" IDENT? "from" IDENT "to" IDENT ("on" IDENT)? pseudoState ::= "FinalState" IDENT | "Choice" IDENT

© F. Fondement

- 14 -

September 2007

State of the art

Grammarware

MDE

Graphics Visual Languages © F. Fondement

- 15 -

September 2007

Strategy

Grammarware

MDE

Graphics Visual Languages © F. Fondement

- 16 -

September 2007

Lexicon z Abstract syntax, metamodel, concepts z Abstract syntax tree (AST), ASG, model z Language sentence = model + representation z Concept instance, model element, instance Abstract Syntax (M etam odel) «conform sTo»

M odel © F. Fondement

«represents» - 17 -

Text September 2007

Contents z Introduction • Model Driven Engineering • Language Definition

z Concrete Syntaxes • Textual concrete syntax definition • Graphical concrete syntax definition

z Conclusions

© F. Fondement

- 18 -

September 2007

Typical Implementation Abstract Syntax (Metamodel)

White: M2 Grey: M1

Templates

«conformsTo» «conformsTo» Code Generator Code

Model

Semantic analysis

Compiler compiler «conformsTo»

Grammar Intermediate tree © F. Fondement

- 19 -

September 2007

Typical Implementation

White: M2 Grey: M1

z Concrete syntax tree and model

Abstract Syntax (Metamodel)

Templates

• Not connected ! • Different nature ! →Hard to relate…. →Hand-coded…

«conformsTo» «conformsTo» Code Generator Code

Model

Semantic analysis

Compiler compiler «conformsTo»

Grammar Intermediate tree © F. Fondement

- 20 -

September 2007

Typical Implementation Abstract Syntax (Metamodel)

z Code generation templates, Grammar, and Semantic analysis

Templates

• Double conformance ! →Double specification… →Triple maintenance points… →No automated coherence proof…

«conformsTo» «conformsTo» Code Generator Code

Model

Semantic analysis

White: M2 Grey: M1

Compiler compiler «conformsTo»

Grammar Intermediate tree © F. Fondement

- 21 -

September 2007

White: M2 Grey: M1

Specification Language

Abstract Syntax (Metamodel)

Textual Concrete Syntax Spec.

«conformsTo»

Model

© F. Fondement

«conformsTo»

Reversible Text Processor

- 22 -

Text

September 2007

Specification Language Metalanguage (e.g. MOF, KerMeta)

«conformsTo»

Textual Concrete Syntax (Metamodel)

«conformsTo»

«conformsTo»

Abstract Syntax (Metamodel)

Textual Concrete Syntax Spec.

«conformsTo»

Model

Black: M3 White: M2 Grey: M1

«conformsTo»

Reversible Text Processor

Text

z No concrete syntax • Help yourself !

© F. Fondement

- 23 -

September 2007

TCSSpec Metamodel Inspired from z EBNF

0..1

ref 1 subRule

• Text structure

Condition 0..1 constraint

TCSSpec

* rule

1..* {ordered}

Sequence

1 rules

Rule

1 subRules

z Netsilon

Action

sideEffect start

1 1 subRule

Alternative

conditions

Iteration 0..1

Template Terminal

separator terminal : String

1..* BooleanQuery

1 metaClass

Value

Class

*

className : String metaClasses 0..1

RuleRef

PrimitiveValue

ObjectRef

Feature container 0..1 className : String feature featureName : String 1

* features

identifier

© F. Fondement

- 24 -

September 2007

TCSSpec Metamodel Inspired from z EBNF z Netsilon

0..1

ref 1 subRule

Condition 0..1 constraint

TCSSpec

* rule

1..* {ordered}

Sequence

1 rules

Rule

1 subRules

• Model Navigation

Action

sideEffect start

1 1 subRule

Alternative

conditions

Iteration 0..1

Template Terminal

separator terminal : String

1..* BooleanQuery

1 metaClass

Value

Class

*

className : String metaClasses 0..1

RuleRef

PrimitiveValue

ObjectRef

Feature container 0..1 className : String feature featureName : String 1

* features

identifier

© F. Fondement

- 25 -

September 2007

close

closed

opened

unlocked

open

lock

unlock

Door:StateMachine top :Transition

target

subvertex

locked

closed:CompositeState

transition :PseudoState subvertex kind=initial

subvertex

:Transition

:Transition target

kind=initial

subvertex

source

source

transition

:PseudoState

source

opened:SimpleState target

unlocked:SimpleState source source :Transition

transition :Transition

transition

target

target

subvertex

transition

locked:SimpleState

The Model

© F. Fondement

subvertex

StateMachine Door CompositeState { initial State opened CompositeState closed { initial State unlocked State locked Transition from unlocked to locked on lock Transition from locked to unlocked on unlock Transition from unlocked to opened on open } Transition from opened to closed on close } - 26 -

A Textual Representation

:CompositeState

A Graphical Representation

Example

September 2007

Example TCSS start template for StateMachine ::= "StateMachine" self.name self.top:=stateR; rule stateR ::= {OCL| self.oclIsKindOf(SimpleState)}? ssr | {OCL| self.oclIsKindOf(CompositeState)}? csr template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}" Abstract Syntax (Metamodel)

rule init ::= {OCL| self.incoming.source->exists(s| s.oclIsKindOf(PseudoState) and s.oclAsType(PseudoState).kind = initial) «conformsTo» }? "initial" =>{KerMeta| var _init:PseudoState init PseudoState.new var _t:Transition init Transition.new _init.kind := PseudoStateKind#initial Reversible _t.source := _init _t.target := self} Text … Model Processor

© F. Fondement

- 27 -

Textual Concrete Syntax Spec.

«conformsTo»

Text

September 2007

Example: Synthesis (i.e. model to text)

Abstract Syntax (Metamodel)

Textual Concrete Syntax Spec.

«conformsTo»

Model

© F. Fondement

«conformsTo»

Reversible Text Processor

- 28 -

Text

September 2007

Example: Synthesis start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

self Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 29 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 30 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 31 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 32 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door) • stateR (Door.top)

rule stateR ::= {OCL| self.oclIsKindOf(SimpleState)}? ssr | {OCL| self.oclIsKindOf(CompositeState)}? csr

StateMachine Door

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 33 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door) • stateR (Door.top) • csr (Door.top)

template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}"

StateMachine Door

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

CompositeState {

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 34 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door) • stateR (Door.top) • csr (Door.top)

template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}"

StateMachine Door

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

CompositeState {

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 35 -

September 2007

Example: Synthesis

• Rule stack • StateMachine (Door) • stateR (Door.top) • csr (Door.top)

template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}"

StateMachine Door

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

opened:SimpleState

state

locked:SimpleState

© F. Fondement

state

- 36 -

September 2007

Example: Analysis (i.e. text to model)

Abstract Syntax (Metamodel)

Textual Concrete Syntax Spec.

«conformsTo»

Model

© F. Fondement

«conformsTo»

Reversible Text Processor

- 37 -

Text

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

:StateMachine

- 38 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

:StateMachine

- 39 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door Door:StateMachine

CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

name:"Door"

- 40 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door | CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

Door:StateMachine

- 41 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door) • stateR

rule stateR ::= {OCL| self.oclIsKindOf(SimpleState)}? ssr | {OCL| self.oclIsKindOf(CompositeState)}? csr

??? Let’s try This !

StateMachine Door | CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

Door:StateMachine

- 42 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door) • stateR • ssr (SimpleState)

template ssr for SimpleState ::= init "State" self.name

Ooops ! Backtrack !

StateMachine Door CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

Door:StateMachine

:SimpleState

- 43 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door) • stateR

rule stateR ::= {OCL| self.oclIsKindOf(SimpleState)}? ssr | {OCL| self.oclIsKindOf(CompositeState)}? csr

Let’s try This, then !

StateMachine Door | CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

Door:StateMachine

- 44 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door) • stateR • csr (:CompositeState)

template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}"

StateMachine Door CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

© F. Fondement

Door:StateMachine

:CompositeState

- 45 -

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door) • stateR • csr (:CompositeState)

template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}"

StateMachine Door CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

Results of stateR

Door:StateMachine

:CompositeState

:PseudoState kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState opened:SimpleState

state

locked:SimpleState

© F. Fondement

- 46 -

state

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door) • stateR • csr (:CompositeState)

template csr for CompositeState ::= init "CompositeState" self.name "{" self.state:=(stateR)* "}"

StateMachine Door Door:StateMachine state

CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

- 47 -

state

September 2007

• Rule stack

Example: Analysis

• StateMachine (Door)

start template for StateMachine ::= "StateMachine" self.name self.top:=stateR;

StateMachine Door

Result of stateR

CompositeState { initial State opened CompositeState closed { initial State unlocked State locked … } … }|

Door:StateMachine top

state

:CompositeState

:PseudoState state kind=initial

closed:CompositeState

:PseudoState kind=initial

state

unlocked:SimpleState state

opened:SimpleState

state

locked:SimpleState

© F. Fondement

- 48 -

state

September 2007

Prototypes: Sintaks (from UHA)

Abstract Syntax (Metamodel)

Textual Concrete Syntax Spec.

«conformsTo»

Model

© F. Fondement

«conformsTo»

Reversible Text Sintaks Processor

- 49 -

Text

September 2007

Prototypes: TCSSL Tools (from CEA)

Abstract Syntax (Metamodel)

Templates

«conformsTo» «conformsTo»

Jet Abstract Syntax (Metamodel)

Textual Concrete Syntax Spec.

«conformsTo»

Model

«conformsTo»

Reversible Text Processor

Code Generator

TCSSL tools

Code

Model

Semantic analysis

Compiler compiler «conformsTo»

Text

Grammar Intermediate tree

© F. Fondement

- 50 -

September 2007

Conceptual differences z TCSSL Tools (CEA)

y t li i

• Instantiation rules

• Create / search / search and create if not exists

• Auto-call of sub-rules according to inheritance hierarchy

b i x e l F

• Avoids the stateR rule • A problem for rule precedence

• Tests limited to comparisons

• Tests interpreted as actions at analysis

z Sintaks (UHA)

• Test limited to specific queries

y t fe

• Attribute values • Object types

• No actions • Late binding of references

a S

© F. Fondement

- 51 -

September 2007

Question

Abstract Syntax

Concrete Syntax

What is the good Gap ?

© Royalty-Free/Corbis

© F. Fondement

- 52 -

September 2007

Contents z Introduction • Model Driven Engineering • Language Definition

z Concrete Syntaxes • Textual concrete syntax definition • Graphical concrete syntax definition

z Conclusions

© F. Fondement

- 53 -

September 2007

White: M2 Grey: M1

Typical Implementation z Proprietary Interaction

Mapping

• Icon editors • Representation model

Abstract Syntax (Metamodel)

z Connection based

«conformsTo» Representation Language Model Meta-CASE

Diagram

Representation Data

© F. Fondement

- 54 -

September 2007

White: M2 Grey: M1

Typical Implementation z Graph grammars Interaction

Mapping

• Triple graph grammars • Hypergraph transformations

Abstract Syntax (Metamodel)

z Model transformation • Reversible ?

«conformsTo»

z Naïve

Representation Language

• Small gap

z Forgotten • No gap

Model Meta-CASE

Diagram

Representation Data

© F. Fondement

- 55 -

September 2007

Typical Implementation

Interaction

Mapping

z z z z

Abstract Syntax (Metamodel)

White: M2 Grey: M1 Dedicated model Graph grammars Triple graph grammars Forgotten • Default interactions at icon level • Mapping much more complex

«conformsTo» Representation Language Model Meta-CASE

Diagram

Representation Data

© F. Fondement

- 56 -

September 2007

Typical Implementation

Interaction

Mapping

White: M2 Grey: M1

z UML-DI z Proprietary

Abstract Syntax (Metamodel) «conformsTo»

Representation Language Model Meta-CASE

Diagram

Representation Data

© F. Fondement

- 57 -

September 2007

Typical Implementation

White: M2 Grey: M1

z Not adopted by industry yet Interaction

Mapping

• MVC with 2D graphical libraries

Abstract Syntax (Metamodel) «conformsTo»

Representation Language Model Meta-CASE

Diagram

Representation Data

© F. Fondement

- 58 -

September 2007

White: M2 Grey: M1

Problems z Not limited to connection-based languages z Reversible mapping z Versatile representation language z Clear representation data structure z Library of reusable interactions

© F. Fondement

- 59 -

September 2007

White: M2 Grey: M1

Idea

Interaction

Mapping

Abstract Syntax (Metamodel) «conformsTo»

Representation Language

predefined interaction library

Mapping

Representation Templates

Graphical Syntax (Metamodel)

SVG Renderer «conformsTo» «conformsTo»

Meta-CASE

Diagram

Representation Data

© F. Fondement

«conformsTo»

Model

Model

Diagram

Abstract Syntax (Metamodel)

- 60 -

Representation Data

September 2007

Graphical concrete syntax definition z Concrete syntax model and mapping • Fixes concrete syntax elements • Fixes relationship with abstract syntax

z Concrete syntax graphical design • • • •

Mapping

Representation Templates

Graphical Syntax (Metamodel)

«conformsTo»

Model

Fixes appearance Fixes layout constraints Fixes edition facilities Fixes link with concrete syntax model

© F. Fondement

predefined interaction library

Abstract Syntax (Metamodel)

SVG Renderer «conformsTo» «conformsTo»

Diagram

- 61 -

Representation Data

September 2007

Graphical syntax metamodel Graphical Syntax (Metamodel)

Graphical Editor ↑ Relates a model and a graphical representation

© F. Fondement

Abstract Syntax (Metamodel)

Mapper

Model Repository

↑ z Avoids Relates two things abstract/concrete of same nature syntax pollution

z Improves reusability z Minimizes maintenance points z Mapping can be complex (large gap !)

- 62 -

September 2007

The Representation Language z Render Vector Graphics • Render “Terminal” Symbols • As open as possible

z Controllable by an API (online rendering) • Implementation for interaction library • Possibility to specify variation points • Mean to access the model

z Possibility to specify layout constraints

© F. Fondement

- 63 -

September 2007

The Representation Language 9 Render Vector Graphics 9Not connection-based only 9As open as possible

z Controllable by an API (online rendering) • Implementation for interaction library • Possibility to specify variation points • Mean to access the model

z Possibility to specify layout constraints

SVG

© F. Fondement

- 64 -

September 2007

The Representation Language 9 Render Vector Graphics 9Not connection-based only 9As open as possible

9 Controllable by an API (online rendering) 9Implementation for interaction library 9Possibility to specify variation points 9Mean to access the model

z Possibility to specify layout constraints

SVG

© F. Fondement

+

DOM

- 65 -

September 2007

The Representation Language 9 Render Vector Graphics 9Not connection-based only 9As open as possible

9 Controllable by an API (online rendering) 9Implementation for interaction library 9Possibility to specify variation points 9Mean to access the model

9 Possibility to specify layout constraints

SVG

© F. Fondement

+

DOM

- 66 -

+

C-SVG

September 2007

Graphical concrete syntax definition z Concrete syntax model DOM interaction library

Mapping

SVG Templates

Graphical Syntax (Metamodel)

Abstract Syntax (Metamodel) «conformsTo»

z Concrete syntax graphical design (with a demo) • • • •

Model SVG Renderer «conformsTo» «conformsTo»

SVG Document

• Fixes concrete syntax elements • Fixes relationship with abstract syntax

Fixes appearance Fixes layout constraints Fixes edition facilities Fixes link with concrete syntax model

Representation Data

© F. Fondement

- 67 -

September 2007

Concrete syntax metamodel (Example) «Interface» GraphicalObject

Display Classes

contains() connects() nearby() overlaps() ... (?)

SVGTransition 1 «connects» SVGArrowEnd start 1 «connects» SVGArrowEnd end 1 SVGText «nearby» event text:String

SVGSimpleState 1 «contains» name

SVGText

SVGPseudo State SVGInitial

... © F. Fondement

SVGChoice

- 68 -

September 2007

Graphical concrete syntax definition z Concrete syntax model DOM interaction library

Mapping

SVG Templates

Graphical Syntax (Metamodel)

Abstract Syntax (Metamodel) «conformsTo»

z Concrete syntax graphical design (with a demo) • • • •

Model SVG Renderer «conformsTo» «conformsTo»

SVG Document

• Fixes concrete syntax elements • Fixes relationship with abstract syntax

Fixes appearance Fixes layout constraints Fixes edition facilities Fixes link with concrete syntax model

Representation Data

© F. Fondement

- 69 -

September 2007

Display managers

«Interface» GraphicalObject

Constraining Part

Transition Scheme

MetaClasses Transition

me 1

Iconic Part Display Classes

Display Manager Classes dm 1

TransitionDM

vo 1

contains() connects() nearby() overlaps()

SVGTransition

1 «connects» SVGArrowEnd start 1 «connects» SVGArrowEnd end

PseudoState Scheme

State Scheme

1 SVGText «nearby» event text:String Simple me State 1

dm

Simple StateDM *

vo 1

SVGSimpleState

1 «contains» name Pseudo me State 1

dm

Pseudo 1 StateDM

vo SVGPseudo State 1 SVGInitial

... © F. Fondement

SVGText

- 70 -

SVGChoice

September 2007

Solving abstract/concrete synch. A text is shown on the top of transitions to represent the triggering event if it exists. ModelElement

Transition

name : String

me 1

dm 1

TransitionDM

trigger 0..1

SVGTransition

1 «connects» SVGArrowEnd end

*

context TransitionDM inv: if self.me.trigger−>isEmpty() then self.vo.event.text.size() = 0 else self.vo.event.text = self.me.trigger.name endif

© F. Fondement

1

1 «connects» SVGArrowEnd start

Event

Transition

vo

- 71 -

1 SVGText «nearby» event text:String

September 2007

Alternatives Composite state is depicted either by a text showing the name of the composite state, or by a region showing the contents of the composite state, or both. In the latter case, the two regions are separated by a line. Composite me State 1

dm *

Composite StateDM showName showContent

vo SVGComposite State 1 1 0..1 SVGText name 0..1 separator 0..1

SVGLine SVGContents

context CompositeStateDM inv: self.showName = self.vo.name−>notEmpty() and self.showContent = self.vo.contents−>notEmpty() and (self.showName and self.showContent ) = self.vo.separator−>notEmpty() contents

© F. Fondement

- 72 -

September 2007

Graphical concrete syntax definition z Concrete syntax model DOM interaction library

Mapping

SVG Templates

Graphical Syntax (Metamodel)

Abstract Syntax (Metamodel) «conformsTo»

z Concrete syntax graphical design (with a demo) • • • •

Model SVG Renderer «conformsTo» «conformsTo»

SVG Document

• Fixes concrete syntax elements • Fixes relationship with abstract syntax

Fixes appearance Fixes layout constraints Fixes edition facilities Fixes link with concrete syntax model

Representation Data

© F. Fondement

- 73 -

September 2007

Solving appearance Iconic Part Display Classes SVGTransition 1 «connects» SVGArrowEnd start



1 «connects» SVGArrowEnd end 0..1 SVGText «nearby» event text:String

SVGSimpleState 1 «contains» name

SVGText

SVGPseudo State SVGInitial

...



© F. Fondement

- 76 -

September 2007

Graphical concrete syntax definition z Concrete syntax model DOM interaction library

Mapping

SVG Templates

Graphical Syntax (Metamodel)

Abstract Syntax (Metamodel) «conformsTo»

z Concrete syntax graphical design (with a demo) • • • •

Model SVG Renderer «conformsTo» «conformsTo»

SVG Document

• Fixes concrete syntax elements • Fixes relationship with abstract syntax

Fixes appearance Fixes layout constraints Fixes edition facilities Fixes link with concrete syntax model

Representation Data

© F. Fondement

- 77 -

September 2007

DopiDOM Conceptual Framework SVGScene getElementsAt(x, y) : XMLElement [*] {ordered} getElementsUnder(XMLNode) : XMLElement [*] {ordered} getInterfaceAtForEvent(x, y, EventKind) : Interface ... 0..1 0..1 parent 1 XMLNode * kind children

document

Locatable

*

x y

selection 1 holder

*

Interface

* 1 consumableEvent

* XMLAttribute

dx dy

EventKind

name value

... Location

1 * instance

context Interface::consume (e:Event) pre: e.kind = self.eventKind

Translatable

consume(e: Event)

1

x y

Event Translation dx dy

...

z Parallel for interactors © F. Fondement

- 78 -

September 2007

DopiDOM components library Interface

Interface

BorderSlidable

Stickable

DirectionAdjustable

Translatable

Locatable

BorderFindable

Positionable

OriginGettable

Containable

Container

Editable

© F. Fondement

edi|

0

Etc…

- 79 -

September 2007

Solving edition facilities CompositeState template

© F. Fondement

- 80 -

September 2007

Graphical concrete syntax definition z Concrete syntax model DOM interaction library

Mapping

SVG Templates

Graphical Syntax (Metamodel)

Abstract Syntax (Metamodel) «conformsTo»

z Concrete syntax graphical design (with a demo) • • • •

Model SVG Renderer «conformsTo» «conformsTo»

SVG Document

• Fixes concrete syntax elements • Fixes relationship with abstract syntax

Fixes appearance Fixes layout constraints Fixes edition facilities Fixes link with concrete syntax model

Representation Data

© F. Fondement

- 81 -

September 2007

Representation Link: DopiDOM events z Events depend on DopiDOM component z Reaction to events defined in templates • Java JMI or EMF, KerMETA, Xion, etc.

z Initial / Load / Save scripts

CompositeState template

© F. Fondement

- 82 -

September 2007

Representation Link: Value events z One listener synchronizing

• An attribute value on the model with • an attribute value on the SVG document

SimpleState template revisited © F. Fondement

- 83 -

Graphical Syntax (Metamodel)

September 2007

CS: Another MDE Component Language Engineering «include»

«include»

Concrete Syntax Engineering

«include»

Abstract Syntax Engineering «include»

CS Realization

«include»

CS Specification

AS/CS Mapping

DO M interaction library

Mapping

SVG Tem plates

G raphical Syntax (Metam odel)

© F. Fondement

- 84 -

Abstract Syntax (Metam odel)

September 2007

CS: Another MDE Component Language Engineering «include»

«include»

Concrete Syntax Engineering

«include»

CS Realization

Abstract Syntax Engineering «include»

«include»

CS Specification

AS/CS Mapping Metamodel Expert

SVG Expert

CS Realizer

© F. Fondement

CS Designer

- 85 -

CS Applyer

September 2007

Contents z Model Driven Engineering z Concrete Syntaxes • Textual concrete syntax definition • Graphical concrete syntax definition

z Conclusions

© F. Fondement

- 86 -

September 2007

Conclusions z Language proliferation (MDE+DSM) • Language engineering is a key

z Solutions to fill abstract/concrete syntax gap • Abstract syntax provided as a metamodel • Focus on executable specifications • Missing OCL constraint solver… • Human readable/productible ?

© F. Fondement

- 87 -

September 2007

Contributions z Textual concrete syntax

Textual Concrete Syntax Spec.

• “mapping” metamodel

z Method for graphical concrete syntax specification • Metamodel for representation data • Interface for the concrete syntax

• Mapping to abstract syntax

Graphical Editor

Graphical Syntax (Metamodel)

Abstract Syntax (Metamodel)

Mapper

Model Repository

z Technology for graphical concrete syntax realization • Representation using SVG templates • Library of possible user interactions



z Other technologies apply • (Triple) Graph Grammars • GMF, Topcased, … © F. Fondement

- 88 -

September 2007

Analytic –vs.– Interactive CS z Solutions to textual and graphical CS are very different • Textual • Graphical

=> usually analytic => usually interactive

(with small gap) (from no gap to large gap)

z Unification of solutions ? z Inversion of solutions ?

© F. Fondement

- 89 -

September 2007

Towards “Agile” Language Engineering z Agile MDE Definition • Knowledge from real specialists ! • “off-the-shelf (MDE) components” • Adaptable to each project

Compiler Provider

CASE tool Provider

Language Engineering

Domain Engineer

«include»

Language Composition «include» Language Tuning

Project Architect

© F. Fondement

- 90 -

September 2007

Thank you !

© F. Fondement

- 91 -

September 2007