Component-Based Semantics
Peter D. Mosses
Swansea University (emeritus) TU Delft (visitor)
IFIP WG 2.2 Meeting, Bordeaux, September 2017
Component-Based Semantics Peter D. Mosses Swansea University - - PowerPoint PPT Presentation
Component-Based Semantics Peter D. Mosses Swansea University (emeritus) TU Delft (visitor) IFIP WG 2.2 Meeting, Bordeaux, September 2017 Component-based semantics Aims encourage language developers to use formal semantics Means
Peter D. Mosses
Swansea University (emeritus) TU Delft (visitor)
IFIP WG 2.2 Meeting, Bordeaux, September 2017
Aims
Means
Neil Sculthorpe Thomas van Binsbergen
Components are fundamental constructs (‘funcons’)
scope(ρ : envs, X : )T) : )T ρ1/ρ0 ` X ! X0 ρ0 ` scope(ρ1, X) ! scope(ρ1, X0) scope(ρ1, V ) V
Translation of language constructs to funcons
E : expr ::= · · · | value-defs in expr | · · · eval [ [E:expr] ] : ⇒values · · · eval [ [VD in E] ] = scope(decl [ [VD] ], eval [ [E] ]) · · · VD : value-defs ::= · · · decl [ [VD:value-defs] ] : ⇒envs · · ·
Modular SOS (MSOS)
Implicitly-Modular SOS (I-MSOS)
Value-computation specifications, bisimulation congruence format
Signatures with strictness annotations
Structural operational semantics (SOS)
ρ0 ` hD, σi ! hD0, σ0i ρ0 ` hscope(D, X), σi ! hscope(D0, X), σ0i ρ1/ρ0 ` hX, σi ! hX0, σ0i ρ0 ` hscope(ρ1, X), σi ! hscope(ρ1, X0), σ0i ρ0 ` hscope(ρ1, V ), σi ! hV, σi
Implicitly-Modular SOS (I-MSOS)
D ! D0 scope(D, X) ! scope(D0, X) ρ1/ρ0 ` X ! X0 ρ0 ` scope(ρ1, X) ! scope(ρ1, X0) scope(ρ1, V ) ! V
Value-computation specifications, bisimulation congruence format
D ! D0 scope(D, X) ! scope(D0, X) ρ1/ρ0 ` X ! X0 ρ0 ` scope(ρ1, X) ! scope(ρ1, X0) scope(ρ1, V ) V
Signatures with strictness annotations
scope(ρ : envs, X : )T) : )T ρ1/ρ0 ` X ! X0 ρ0 ` scope(ρ1, X) ! scope(ρ1, X0) scope(ρ1, V ) V
Universe
Types
Control flow
Data flow
Values encapsulating computations
Operand evaluation order Funcon and(B1: booleans, B2: booleans) : booleans
Unbounded and bounded arithmetic Funcon integer-add(N1: integers, N2: integers) : integers integer-subtract(N1: integers, N2: integers) : integers … Funcon short-integer(N: integers) : bounded-integers(…,…)
short-integer(integer-subtract(N1, N2)) …
Partial arithmetic operations Funcon integer-divide(N1: integers, N2: integers) : integers|no-value Funcon definitely(V: T|no-value) : ⇒T Rule definitely(V: values) ↝ V Rule definitely(none) ↝ fail
Declarations compute environments Type envs ↝ maps(ids, values|no-value) Funcon bind(I: ids, V: values) : envs bound(I: ids) : ⇒values scope(ρ: envs, X: ⇒T) : ⇒T
Recursive and forward declarations Funcon recursively-bind(I: ids, E: ⇒values) : ⇒environments
Abstractions with static or dynamic binding Funcon abstraction(X: ⇒T) : abstractions(T) close(A: abstractions(T)) : ⇒abstractions(T)
Funcon closure(X: ⇒T) : ⇒abstractions(T) ↝ close(abstraction(X))
Abstractions with a call-by-value or -name argument Funcon force(A: abstractions(T)) : ⇒T
…apply(bound(I), E)…
…apply(bound(I), closure(E)))…
Further programming concepts
Prototype, implemented in Spoofax and Haskell
[Van Binsbergen et al: Modularity 2016]