Reusable specification templates for defining dynamic semantics - - PowerPoint PPT Presentation

reusable
SMART_READER_LITE
LIVE PREVIEW

Reusable specification templates for defining dynamic semantics - - PowerPoint PPT Presentation

Reusable specification templates for defining dynamic semantics of DSLs Ulyana Tikhonova ulyana.tikhonova@constelle.net Tim Willemse Mark van den Brand Domain Specific Languages (DSLs) 2 3 To understand the dynamic semantics To


slide-1
SLIDE 1

Reusable specification templates

Ulyana Tikhonova

ulyana.tikhonova@constelle.net

for defining dynamic semantics

  • f DSLs

Mark van den Brand Tim Willemse

slide-2
SLIDE 2

Domain Specific Languages (DSLs)

2

slide-3
SLIDE 3

3

slide-4
SLIDE 4

Why to define dynamic semantics?

4

  • To understand the dynamic semantics
  • To analyze the dynamic semantics
  • To validate the dynamic semantics
  • To understand and debug

DSL programs

Precise and executable definition

DSL developer DSL user

slide-5
SLIDE 5

What is dynamic semantics?

6

slide-6
SLIDE 6

What is dynamic semantics?

7

1 2 3 4 5

slide-7
SLIDE 7

What is dynamic semantics?

8

1 2 3 4 5

  • To understand the dynamic semantics
  • To analyze the dynamic semantics
  • To validate the dynamic semantics
  • To understand and debug DSL programs
slide-8
SLIDE 8

Dynamic semantics as requirements vs. dynamic semantics as an actual implementation

9

  • To understand the dynamic semantics
  • To analyze the dynamic semantics
  • To validate the dynamic semantics
  • To understand and debug DSL programs
slide-9
SLIDE 9

10

Specification templates

slide-10
SLIDE 10

Defining dynamic semantics of programming languages

11

Semantic mapping Semantic domain

  • Variables/memory
  • Control flow
  • Branching

Language constructs (statements)

slide-11
SLIDE 11

Defining dynamic semantics of domain specific languages

12

Semantic mapping Semantic domain

  • Variables/memory
  • Control flow
  • Branching

DSL constructs (statements)

slide-12
SLIDE 12

Defining dynamic semantics of domain specific languages

13

Semantic mapping Semantic domain

  • Variables/memory
  • Control flow
  • Branching

DSL constructs (statements) Semantic domain Semantic mapping

  • Architecture layers
  • Design patterns
  • Synchronization protocols

Specification templates

slide-13
SLIDE 13

Defining dynamic semantics of domain specific languages

14

Semantic mapping Semantic domain

  • Variables/memory
  • Control flow
  • Branching

DSL constructs (statements) Semantic domain Semantic mapping

  • Architecture layers
  • Design patterns
  • Synchronization protocols

Specification templates

slide-14
SLIDE 14

16

MACHINE queue_machine SEES queue_context VARIABLES queue INVARIANTS inv1: queue ∈ ℕ ⇸ ElementType EVENTS INITIALISATION ≙ act1: queue ≔ ∅ END enqueue≙ ANY element, index WHERE grd1: element ∈ ElementType grd2: index ↦ element ∈ queue grd3: ∀i·i ∈ dom(queue) ⇒ index ≤ i THEN act1: queue ≔ queue ∖ {index ↦ element} END dequeue≙ ANY element, index WHERE grd1: element ∈ ElementType grd2: index ∈ ℕ grd3: queue ≠ ∅ ⇒ (∀i·i ∈ dom(queue) ⇒ index > i) grd4: {index ↦ element} ∈ ℕ ⇸ ElementType grd5: index ∉ dom(queue) THEN act2: queue ≔ queue ∪ {index ↦ element} END END

MyType MyType MyType MyType

slide-15
SLIDE 15

17

MACHINE queue_machine SEES queue_context VARIABLES queue INVARIANTS inv1: queue ∈ ℕ ⇸ ElementType EVENTS INITIALISATION ≙ act1: queue ≔ ∅ END dequeue≙ ANY element, index WHERE grd1: element ∈ ElementType grd2: index ∈ ℕ grd3: queue ≠ ∅ ⇒ (∀i·i ∈ dom(queue) ⇒ index > i) grd4: {index ↦ element} ∈ ℕ ⇸ ElementType grd5: index ∉ dom(queue) THEN act2: queue ≔ queue ∪ {index ↦ element} enqueue≙ ANY element, index WHERE grd1: element ∈ ElementType grd2: index ↦ element ∈ queue grd3: ∀i·i ∈ dom(queue) ⇒ index ≤ i THEN act1: queue ≔ queue ∖ {index ↦ element} END

Logical action Subsystem action

  • ccurrence

Subsystem Subsystem action *

bo dy

1

typ e

1

typ e

* Order Scan Data Node Data type Dataflow Data Transformation

1

typ e

*

1. .*

* *

0. .1 1 1

t

  • fro

m

1 1

t

  • fro

m

* * * * *

inp ut

  • utput

inp ut

  • utput

DSL metamodel Event-B specification

Structural interface

Substitution

Structural interface

Constelle

MyType MyType MyType MyType

slide-16
SLIDE 16

Defining dynamic semantics of domain specific languages

18

Semantic mapping Semantic domain

  • Variables/memory
  • Control flow
  • Branching

DSL constructs (statements) Semantic domain Semantic mapping

  • Architecture layers
  • Design patterns
  • Synchronization protocols

Specification templates

slide-17
SLIDE 17

Mapping DSL constructs to specification templates

19

1 2 3 4 5

slide-18
SLIDE 18

20

VARIABLES curr_job, curr_la, la_input, ssa_output INVARIANTS la_input ∈ ℕ ⇸ LogicalActions ssa_output ∈ ℕ ⇸ SSActions curr_job ∈ ℙ(SSAOccurences) curr_la ∈ LogicalActions EVENTS Initialisation curr_la :∈ LogicalActions curr_job ≔  la_input ≔  ssa_output ≔  request_la (la, n) where la ∈ LogicalActions curr_job =  n ∈ ℕ la_input ≠  ⇒ ∀ i · i ∈ dom(la_input) ⇒ n > i then curr_job ≔ dom(LALabelDef(la)) curr_la ≔ la la_input ≔ la_input ∪ { n ↦ la } request_ssa (ssaction, occurence) where

  • ccurence ∈ curr_job
  • ccurence ↦ ssaction ∈ LALabelDef (curr_la)

then curr_job ≔ curr_job \ {occurence} execute_ssa (ssaction, n) where ssaction ∈ SSActions n ∈ ℕ ssa_output ≠  ⇒ ∀ i · i ∈ dom(ssa_output) ⇒ n > i then ssa_output ≔ ssa_output ∪ { n ↦ ssaction } END

slide-19
SLIDE 19

Aspect Oriented Programming: cross cutting concerns

21

Queue enqueue dequeue Listener subscribe notify Partial Order init_partial_order is_max_element remove_element

  • peration1

subscribe init_partial_order

  • peration2

notify enqueue is_max_element

  • peration3

dequeue remove_element

slide-20
SLIDE 20

Aspect Oriented Programming: composing cross cutting concerns

22

Listener Queue Partial Order

  • peration1

subscribe init_partial_order

  • peration2

notify enqueue is_max_element

  • peration3

dequeue remove_element Specializations of specification templates from the library

slide-21
SLIDE 21

Constelle

23

Substitution of template (static) parameters with DSL types Operations

  • f the DSL

dynamic semantics Aspects = specification templates

slide-22
SLIDE 22

Constelle

24

Meta-model DSL model Event-B specification templates Event-B specification

DSL/Ecore Event-B/Rodin

Specification templates Constelle definition Constelle-to-Event-B

slide-23
SLIDE 23

Future work

25

  • Scalability and applicability of the proposed method

– Validated on three different DSLs

  • A library of specification templates

– State machine, communication channels, data typing, design patterns (Listener), data structures (Queue)

  • Specification templates for bridging

technological diversity

– Source code, visualization templates, formal notations

slide-24
SLIDE 24

More details: SoSyM paper & PhD thesis

26