event b specification templates for defining dynamic
play

Event-B specification templates for defining dynamic semantics - PowerPoint PPT Presentation

Event-B specification templates for defining dynamic semantics of DSLs Ulyana Tikhonova u.tikhonova@tue.nl Mark van den Brand, Tim Willemse, Tom Verhoeff, Maarten Manders Language concepts (statements) Semantic mapping Operational


  1. Event-B specification templates for defining dynamic semantics of DSLs Ulyana Tikhonova u.tikhonova@tue.nl Mark van den Brand, Tim Willemse, Tom Verhoeff, Maarten Manders

  2. Language concepts (statements) Semantic mapping • Operational semantics (SOS) • Variables/memory Semantic domain • Control flow • Action semantics • Branching • Denotational semantics Defining dynamic semantics of programming languages 2

  3. Domain-Specific Languages (DSLs) 3

  4. 4

  5. Language concepts (statements) Semantic mapping • Operational semantics (SOS) • Variables/memory Semantic domain • Control flow • Action semantics • Branching • Denotational semantics Defining dynamic semantics of domain specific languages 5

  6. Language concepts (statements) Semantic mapping • Architecture layers • Design patterns Semantic domain • Synchronization protocols Semantic mapping • Operational semantics (SOS) • Variables/memory Semantic domain • Control flow • Action semantics • Branching • Denotational semantics Defining dynamic semantics of domain specific languages 6

  7. Language concepts (statements) Semantic mapping • Architecture layers Specification • Design patterns Semantic domain templates • Synchronization protocols Semantic mapping • Simulation • Variables/memory Semantic domain • Control flow • Formal analysis • Branching • Visualization Defining dynamic semantics of domain specific languages 7

  8. 8

  9. 9

  10. VARIABLES curr_job, curr_la, la_input, ssa_output request_ssa (ssaction, occurence) INVARIANTS where la_input ∈ ℕ ⇸ LogicalActions occurence ∈ curr_job ssa_output ∈ ℕ ⇸ SSActions occurence ↦ ssaction ∈ LALabelDef (curr_la) curr_job ∈ ℙ (SSAOccurences) then curr_la ∈ LogicalActions curr_job ≔ curr_job \ {occurence} EVENTS Initialisation execute_ssa (ssaction, n) curr_la : ∈ LogicalActions where curr_job ≔ ∅ ssaction ∈ SSActions la_input ≔ ∅ n ∈ ℕ ssa_output ≔ ∅ ssa_output ≠ ∅ ⇒ ∀ i · i ∈ dom(ssa_output) ⇒ n > i request_la (la, n) then where ssa_output ≔ ssa_output ∪ { n ↦ ssaction } la ∈ LogicalActions curr_job = ∅ END 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 } 10

  11. static void MakeAtLeast<T>(T[] list, T lowest) where T : IComparable<T> { for (int i = 0; i < list.Length; i++) if (list[i].CompareTo(lowest) < 0) list[i] = lowest; } static void Main() { int [] array = { 0, 1, 2, 3 }; MakeAtLeast< int >(array, 2); } Generic programming: reuse of code 11

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

  13. method1 Queue subscribe enqueue Listener init_partial_order dequeue subscribe method2 notify notify enqueue is_max_element Partial Order method3 init_partial_order dequeue is_max_element remove_element remove_element Aspect Oriented Programming: cross cutting concerns 13

  14. Listener Queue Partial Order method1 subscribe init_partial_order method2 notify enqueue is_max_element method3 dequeue remove_element Specializations of specification templates from the generic library 14

  15. 15 demo

  16. Event-B/Rodin Specification Event-B templates specification templates DSL/Ecore Constelle Meta-model definition Constelle-to-Event-B Event-B DSL model specification 16

  17. Conclusions • Constelle as a front-end – Reuse of Event-B code via generic programming – Clear design via composition/mapping of aspects – Intermediate layer for bridging different technological platforms • Event-B as a back-end – Generic instantiation – (Shared event) composition – Library of reusable specification templates 17

Recommend


More recommend