10 17 2011
play

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


  1. 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 Andova • semantics: − static semantics − dynamic semantics / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 1 Dynamic Semantics Dynamic Semantics Semantics represents the intended meaning of a language and Not every language is suitable for describing dynamic semantics language constructs Dynamic semantics ideally is described in a formal language Semantics is a means to represent our understanding of a (formal semantics) because: model/program (what it does) and − 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 To communicate our understanding to other entities implementation To understand what happens in a computer/machine when a program/model is executed / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 2 / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 3 1

  2. 10/17/2011 Dynamic Semantics in practice Dynamic Semantics in practice • Hardly any modeling language used in industry has formal semantics (domain) model • The semantics of languages is often defined by translation or interpretation (DS) Language • Languages evolve and more ambiguities are introduced (implementation) engine / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 4 / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 5 Dynamic Semantics in practice Dynamic Semantics in practice ? • Ambiguous representation and miscommunication • Model to implementation inconsistency -different understandings of models - SW constructs do not use semantics, only (domain) model (domain) model syntax - Code is manually added in the parts start-start start-start generated start-start b c d (DS) Language (DS) Language a • Cognitive feedback gap between modeling and model/implementation debugging e start-start -no possibility to transfer results of execution/debugging back to the original (implementation) (implementation) model engine engine • Lack of early design correctness analysis how many execution sequences one can think of?  “total” representation required! / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 6 / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 7 2

  3. 10/17/2011 Dynamic Semantics in practice Dynamic Semantics in practice ? perform. perform. perform. simulation test simulation test simulation test ana. ana. ana. model model model model model model model model model transformations transformations • Multi-disciplinary project transformations - Semantic gap between models (DSL) model (DSL) model (DSL) model • Transformation from one env to another 1 2 - Semantic transformation gap - Model transformation correctness reasoning (DS) Language (DS) Language 1 2 (DS) Language (implementation) (implementation) engine2 engine1 (implementation) engine / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 8 / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 9 Describing Dynamic Semantics Describing Dynamic Semantics • (Reference) Implementation - Model/program is executed (Reference) Implementation - Conclusions about the behaviour based - Model/program is executed (DSL) model on observations (DSL) model - Conclusions about the behaviour based on observations • Translational - if the code is complex (as usual) no behavioural analysis - Select target language(s) (DS) Language (DS) Language - Model based in most of the cases • Interpretation • Formal semantics (implementation) (implementation) - structural operational semantics (SOS, MSOS) engine engine - denotational semantics - axiomatic - algebraic - game semantics / Faculteit Wiskunde en Informatica - … 17-10-2011 PAGE 10 / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 11 3

  4. 10/17/2011 Describing Dynamic Semantics Describing Dynamic Semantics Translational semantics Translational semantics direct translation (DSL) model (DSL) model (properties preservation?) Model Model - Model based - Ad-hoc semantic mapping - Ad-hoc syntactic mapping - No semantic mapping -> no ambiguities detection - No semantic mapping -> no ambiguities detection - No support for language Target direct Target (DSL) Language (DSL) Language formal formal translation evolution - No support for language semantics language semantics language evolution - Inconsistency and Properties preservation? - Inconsistency and Properties preservation? - Traceability/reverse mapping (implementation) (implementation) engine - Traceability/reverse mapping engine engine engine Describing Dynamic Semantics Describing Dynamic Semantics Formal semantics • Structural Operational Semantics (SOS, MSOS) − describes the execution of the program on some translation for free! (domain) model Target model (very) abstract machine (G. Plotkin) correct by construction! • Denotational semantics: DSL formal − mathematical definition of input/output relation of the program by formal Target language semantics semantics induction on its syntactic structure (D. Scott, C. Strachey) • Axiomatic semantics (implementation) − formalization of special properties of the program by logical formulae design engine engine decision? (assertions and proof rules; R. Floyd, T. Hoare) - algebraic - event structures - …. / Faculteit Wiskunde en Informatica 17-10-2011 PAGE 15 4

Recommend


More recommend