Tool Support for MSOS Peter Mosses University of Wales Swansea - - PowerPoint PPT Presentation

tool support for msos
SMART_READER_LITE
LIVE PREVIEW

Tool Support for MSOS Peter Mosses University of Wales Swansea - - PowerPoint PPT Presentation

Modularity Tool support Tool Support for MSOS Peter Mosses University of Wales Swansea BCTCS, Nottingham, 22 March 2005 Peter Mosses Tool Support for MSOS Modularity Tool support Outline Modularity of semantic descriptions 1 Tool


slide-1
SLIDE 1

Modularity Tool support

Tool Support for MSOS

Peter Mosses

University of Wales Swansea

BCTCS, Nottingham, 22 March 2005

Peter Mosses Tool Support for MSOS

slide-2
SLIDE 2

Modularity Tool support

Outline

1

Modularity of semantic descriptions

2

Tool support for semantic descriptions

Peter Mosses Tool Support for MSOS

slide-3
SLIDE 3

Modularity Tool support

Semantic descriptions need to be modular!

Modularity is crucial for: extension of described language reuse of parts of descriptions understanding individual constructs

Peter Mosses Tool Support for MSOS

slide-4
SLIDE 4

Modularity Tool support

SOS is not so modular

SOS: Structural Operational Semantics

Plotkin [Aarhus 1981, JLAP 2004]

small-step: rules specify a transition relation big-step: rules specify an evaluation relation rules are generally structural

Peter Mosses Tool Support for MSOS

slide-5
SLIDE 5

Modularity Tool support

SOS is not so modular

SOS: Structural Operational Semantics

Plotkin [Aarhus 1981, JLAP 2004]

small-step: rules specify a transition relation big-step: rules specify an evaluation relation rules are generally structural Unfortunately, in SOS: the notation used in each rule depends on the rest of the described language

Peter Mosses Tool Support for MSOS

slide-6
SLIDE 6

Modularity Tool support

MSOS is highly modular

MSOS: Modular Structural Operational Semantics

PDM [MFCS 1999, JLAP 2004]

simple variant of SOS greater use of labelled transitions/evaluations labels are extensible records

Peter Mosses Tool Support for MSOS

slide-7
SLIDE 7

Modularity Tool support

MSOS is highly modular

MSOS: Modular Structural Operational Semantics

PDM [MFCS 1999, JLAP 2004]

simple variant of SOS greater use of labelled transitions/evaluations labels are extensible records In contrast to SOS: the notation used in each rule is independent of the rest of the described language – much as in monadic denotational semantics

Peter Mosses Tool Support for MSOS

slide-8
SLIDE 8

Modularity Tool support

MSOS example: expressions

E : Exp State ::= Exp Final ::= Value Exp ::= Value

Peter Mosses Tool Support for MSOS

slide-9
SLIDE 9

Modularity Tool support

MSOS example: expression values

V : Value

Peter Mosses Tool Support for MSOS

slide-10
SLIDE 10

Modularity Tool support

MSOS example: if-expressions

Exp ::= if Exp then Exp else Exp Value ::= Boolean

Peter Mosses Tool Support for MSOS

slide-11
SLIDE 11

Modularity Tool support

MSOS example: if-expressions

Exp ::= if Exp then Exp else Exp Value ::= Boolean E1

{...}

− − → E ′

1

if E1 then E2 else E3

{...}

− − → if E ′

1 then E2 else E3

if true then E2 else E3 − → E2 if false then E2 else E3 − → E3

Peter Mosses Tool Support for MSOS

slide-12
SLIDE 12

Modularity Tool support

MSOS example: if-expressions

Conventional notation for abstract syntax: Exp ::= if Exp then Exp else Exp Value ::= Boolean E1

{...}

− − → E ′

1

if E1 then E2 else E3

{...}

− − → if E ′

1 then E2 else E3

if true then E2 else E3 − → E2 if false then E2 else E3 − → E3

Peter Mosses Tool Support for MSOS

slide-13
SLIDE 13

Modularity Tool support

MSOS example: conditional expressions

Language-independent notation for abstract syntax: Exp ::= cond(Exp, Exp, Exp) Value ::= Boolean

Peter Mosses Tool Support for MSOS

slide-14
SLIDE 14

Modularity Tool support

MSOS example: conditional expressions

Language-independent notation for abstract syntax: Exp ::= cond(Exp, Exp, Exp) Value ::= Boolean E1

{...}

− − → E ′

1

cond(E1, E2, E3)

{...}

− − → cond(E ′

1, E2, E3)

cond(true, E2, E3) − → E2 cond(false, E2, E3) − → E3

Peter Mosses Tool Support for MSOS

slide-15
SLIDE 15

Modularity Tool support

MSOS example: declarations

D : Dec State ::= Dec Final ::= Env Dec ::= Env

Peter Mosses Tool Support for MSOS

slide-16
SLIDE 16

Modularity Tool support

MSOS example: environments

ρ : Env = (Id, Bindable)Map

Peter Mosses Tool Support for MSOS

slide-17
SLIDE 17

Modularity Tool support

MSOS example: local declarations

Exp ::= local(Dec, Exp) Label ::= {env : Env, . . .}

Peter Mosses Tool Support for MSOS

slide-18
SLIDE 18

Modularity Tool support

MSOS example: local declarations

Exp ::= local(Dec, Exp) Label ::= {env : Env, . . .} D

{...}

− − → D′ local(D, E)

{...}

− − → local(D′, E) E

{env=ρ0[ρ],...}

− − − − − − − − → E ′ local(ρ, E)

{env=ρ0,...}

− − − − − − → local(ρ, E ′) local(ρ, V ) − → V

Peter Mosses Tool Support for MSOS

slide-19
SLIDE 19

Modularity Tool support

Semantic descriptions need tool support!

Tool support is crucial for: validation of accuracy of descriptions generating prototype implementations teaching semantics

Peter Mosses Tool Support for MSOS

slide-20
SLIDE 20

Modularity Tool support

SOS has some tool support

Execution (mainly for big-step SOS): TypoL [INRIA-Sophia 1987] RML [Pettersson 1996] Letos [Hartel 1997] Living with non-modularity: TinkerType [Levin&Pierce 2000] REK: Rule Evolution Kit [Lämmel 2004] Model-checking, verification, . . .

Peter Mosses Tool Support for MSOS

slide-21
SLIDE 21

Modularity Tool support

MSOS tool support

Using Prolog [PDM 2004]: modular translation from MSDF to Prolog language parsing specified by DCGs (Definite Clause Grammars)

Peter Mosses Tool Support for MSOS

slide-22
SLIDE 22

Modularity Tool support

MSOS tool support

Using Prolog [PDM 2004]: modular translation from MSDF to Prolog language parsing specified by DCGs (Definite Clause Grammars) Using Maude [Braga&Chalub 2004]: modular translation from MSDF to Maude language parsing specified in Maude

Peter Mosses Tool Support for MSOS

slide-23
SLIDE 23

Modularity Tool support

MSOS in MSDF: local declarations

Exp ::= local(Dec, Exp) Label = {env:Env,...} D --{...}-> D’

  • local(D,E):Exp --{...}-> local(D’,E)

(ENV/ENV0) = ENV’, E --{env=ENV’,...}-> E’

  • local(ENV,E):Exp --{env=ENV0,...}-> local(ENV,E’)

local(ENV,V):Exp ---> V

Peter Mosses Tool Support for MSOS

slide-24
SLIDE 24

Modularity Tool support

MSOS in Prolog: local declarations

:-ensure_loaded(’Cons/Exp/ABS’). :-ensure_loaded(’Cons/Dec/ABS’). declare(’Exp’>local(’Dec’, ’Exp’)). :-ensure_loaded(’Data/Env/ABS’). readable(env). local(D, E):’Exp’---X--->local(D_1, E) :- check(D:’D’), check(E:’E’), D:’D’---X--->D_1, check(D_1:’D’). local(ENV, E):’Exp’---X_--->local(ENV, E_1) :- eq_label(X_, [env=ENV0|X]), check(ENV:’ENV’), check(E:’E’), check(ENV0:’ENV’), eq(ENV/ENV0, ENV_1), check(ENV_1:’ENV’), E:’E’---[env=ENV_1|X]--->E_1, check(E_1:’E’). local(ENV, V):’Exp’---U--->V :- check(ENV:’ENV’), check(V:’V’), check(U:’U’). Peter Mosses Tool Support for MSOS

slide-25
SLIDE 25

Modularity Tool support

Work in progress

initial version of MSOS Tool and lecture notes available at www.brics.dk/~pdm/MSOS

Peter Mosses Tool Support for MSOS

slide-26
SLIDE 26

Modularity Tool support

Work in progress

initial version of MSOS Tool and lecture notes available at www.brics.dk/~pdm/MSOS improved version due by summer 2005:

more checking of MSDF specifications more efficient more examples compatible with Maude version of MSOS Tool

Peter Mosses Tool Support for MSOS

slide-27
SLIDE 27

Modularity Tool support

Work in progress

initial version of MSOS Tool and lecture notes available at www.brics.dk/~pdm/MSOS improved version due by summer 2005:

more checking of MSDF specifications more efficient more examples compatible with Maude version of MSOS Tool

CFP: SOS 2005 ICALP workshop, Lisbon, 10 July 2005 www.cs.le.ac.uk/events/SOS2005 Abstract by 13 May – full paper by 23 May

Peter Mosses Tool Support for MSOS