10/17/2011 Dynamic Semantics Definition of a (programming) language - - PDF document

10 17 2011
SMART_READER_LITE
LIVE PREVIEW

10/17/2011 Dynamic Semantics Definition of a (programming) language - - PDF document

10/17/2011 Dynamic Semantics Definition of a (programming) language involves: Generic Language Technology (2IS15) abstract syntax, so-called signature concrete syntax: Dynamic Semantics textual syntax graphical syntax dr. Suzana


slide-1
SLIDE 1

10/17/2011 1

Generic Language Technology (2IS15)

Dynamic Semantics

  • dr. Suzana Andova

Dynamic Semantics

Definition of a (programming) language involves:

  • abstract syntax, so-called signature
  • concrete syntax:

− textual syntax − graphical syntax

  • semantics:

− static semantics − dynamic semantics

/ Faculteit Wiskunde en Informatica

PAGE 1 17-10-2011

Dynamic Semantics

Semantics represents the intended meaning of a language and language constructs Semantics is a means to represent our understanding of a model/program (what it does) and To communicate our understanding to other entities To understand what happens in a computer/machine when a program/model is executed

/ Faculteit Wiskunde en Informatica

PAGE 2 17-10-2011

Dynamic Semantics

Not every language is suitable for describing dynamic semantics Dynamic semantics ideally is described in a formal language (formal semantics) because:

− ambiguities and inconsistencies can be detected in a model which appears to be “ok” − this is the basis for analysis, validation and verification, but also implementation

/ Faculteit Wiskunde en Informatica

PAGE 3 17-10-2011

slide-2
SLIDE 2

10/17/2011 2

Dynamic Semantics in practice

  • Hardly any modeling language used in industry has formal

semantics

  • The semantics of languages is often defined by translation or

interpretation

  • Languages evolve and more ambiguities are introduced

/ Faculteit Wiskunde en Informatica

PAGE 4 17-10-2011

/ Faculteit Wiskunde en Informatica

PAGE 5 17-10-2011

(domain) model (DS) Language (implementation) engine

Dynamic Semantics in practice

/ Faculteit Wiskunde en Informatica

PAGE 6 17-10-2011

(domain) model (DS) Language (implementation) engine

  • Ambiguous representation and

miscommunication

  • different understandings of models

Dynamic Semantics in practice

? a c b d e

start-start start-start start-start start-start

how many execution sequences one can think of?  “total” representation required!

/ Faculteit Wiskunde en Informatica

PAGE 7 17-10-2011

(domain) model (DS) Language (implementation) engine

  • Model to implementation inconsistency
  • SW constructs do not use semantics, only

syntax

  • Code is manually added in the parts

generated

  • Cognitive feedback gap between modeling

and model/implementation debugging

  • no possibility to transfer results of

execution/debugging back to the original model

  • Lack of early design correctness analysis

Dynamic Semantics in practice

slide-3
SLIDE 3

10/17/2011 3

/ Faculteit Wiskunde en Informatica

PAGE 8 17-10-2011

(DSL) model (DS) Language (implementation) engine

  • Transformation from one env to another
  • Semantic transformation gap
  • Model transformation correctness reasoning

Dynamic Semantics in practice

simulation model perform. ana. model test model

transformations

/ Faculteit Wiskunde en Informatica

PAGE 9 17-10-2011

  • Multi-disciplinary project
  • Semantic gap between models

Dynamic Semantics in practice

(DSL) model

1

(DS) Language

1

(implementation) engine1

simulation model perform. ana. model test model

transformations

(DSL) model

2

(DS) Language

2

(implementation) engine2

simulation model perform. ana. model test model

transformations

?

  • (Reference) Implementation
  • Model/program is executed
  • Conclusions about the behaviour based
  • n observations
  • Translational
  • Select target language(s)
  • Model based in most of the cases
  • Interpretation
  • Formal semantics
  • structural operational semantics (SOS, MSOS)
  • denotational semantics
  • axiomatic
  • algebraic
  • game semantics

/ Faculteit Wiskunde en Informatica

PAGE 10 17-10-2011

Describing Dynamic Semantics

(DSL) model (DS) Language (implementation) engine (Reference) Implementation

  • Model/program is executed
  • Conclusions about the behaviour based on
  • bservations
  • if the code is complex (as usual) no behavioural

analysis

/ Faculteit Wiskunde en Informatica

PAGE 11 17-10-2011

Describing Dynamic Semantics

(DSL) model (DS) Language (implementation) engine

slide-4
SLIDE 4

10/17/2011 4

(DSL) model (DSL) Language (implementation) engine

Model

Target language

engine formal semantics direct translation (properties preservation?)

Describing Dynamic Semantics

Translational semantics

  • Model based
  • Ad-hoc syntactic mapping
  • No semantic mapping -> no

ambiguities detection

  • No support for language

evolution

  • Inconsistency and Properties

preservation?

  • Traceability/reverse mapping

(DSL) model (DSL) Language (implementation) engine

Model

Target language

engine formal semantics direct translation

Describing Dynamic Semantics

Translational semantics

  • Ad-hoc semantic mapping
  • No semantic mapping -> no

ambiguities detection

  • No support for language

evolution

  • Inconsistency and Properties

preservation?

  • Traceability/reverse mapping

(domain) model DSL (implementation) engine Target model Target language engine

formal semantics formal semantics

design decision? translation for free! correct by construction!

Describing Dynamic Semantics

Formal semantics

  • Structural Operational Semantics (SOS, MSOS)

− describes the execution of the program on some (very) abstract machine (G. Plotkin)

  • Denotational semantics:

− mathematical definition of input/output relation of the program by induction on its syntactic structure (D. Scott, C. Strachey)

  • Axiomatic semantics

− formalization of special properties of the program by logical formulae (assertions and proof rules; R. Floyd, T. Hoare)

  • algebraic
  • event structures
  • ….

/ Faculteit Wiskunde en Informatica

PAGE 15 17-10-2011

Describing Dynamic Semantics