A Tutorial on Action Semantics

A Tutorial on Action Semantics

A Tutorial on Action Semantics DRAFT 1 Peter D Mosses Computer Science Department Aarhus University Ny Munkegade Bldg DK Aarhus C Denmark Octob er NB This draft is incomplete and unpolished It is not to be copied without the written p ermission of the author 1 Internet p dmossesdaimiaaudk Contents Introduction Motivation Requirements Features Concepts Syntax Concrete Syntax Abstract Syntax ContextSensitive Syntax Semantics Semantic Functions Semantic Entities Pragmatics An Illustrative Example Abstract Syntax Expressions Statements Declarations Programs Semantic Functions Expressions Statements Declarations Programs Conclusion A An Illustrative Example ctd B Action Notation C Data Notation i Abstract Formal semantics is a topic of ma jor imp ortance in the study of programming languages Its applications include do cumenting language design establishing standards for implementations reasoning ab out programs and generating compilers This tutorial is ab out action semantics a recentlydeveloped framework for formal seman tics The primary aim of action semantics is to allow useful semantic descriptions of realistic programming languages Action semantics combines formality with many go o d pragmatic features Regarding com prehensibility and accessibility for instance action semantic descriptions comp ete with informal language descriptions Action semantic descriptions scale up smo othly from small example lan guages to fullblown practical languages The addition of new constructs to a describ ed language do es not require reformulation of the alreadygiven description An action semantic description of one language can make widespread reuse of that of another related language All these prag matic features are highly desirable Action semantics is however the only semantic framework that enjoys them Action semantics is compositional like denotational semantics The main dierence b etween action semantics and denotational semantics concerns the universe of semantic entities action semantics uses entities called actions rather than the higherorder functions used with deno tational semantics Actions are inherently more op erational than functions when performed actions pro cess information gradually Primitive actions and the various ways of combining actions corresp ond to fundamental concepts of information pro cessing Action semantics provides a particular notation for express ing actions The symbols of action notation are suggestive words rather than cryptic signs which makes it p ossible to get a broad impression of an action semantic description from a sup ercial reading even without previous exp erience of action semantics The action combina tors a notable feature of action notation ob ey desirable algebraic laws that can b e used for reasoning ab out semantic equivalence This tutorial provides a quick halfday introduction to action semantics It should b e accessible to senior undergraduates and to professional programmers No previous knowledge of formal semantics is assumed For further study a full exp osition of the framework and an extended example are provided in Mos Chapter sketches the background for action semantics motivating the formal description of programming languages by considering the requirements of various p otential users Chapter recalls the notions of abstract syntax and comp ositional semantics and introduces the novel concept of actions as used in action semantics Chapter takes a walk through an illustrative description explaining all the notation that it uses Chapter assesses the pragmatic qualities of action semantic descriptions and compares the framework to VDM and RAISE The App endices provide a full algebraic sp ecication of the sp ecial notation used together with an informal summary of the standard notation Chapter Introduction This chapter provides some background for the topic of this tutorial namely the action semantic description of programming languages We start by identifying some imp ortant uses for descrip tions of programming languages Although various uses require dierent features of descriptions these requirements are not necessarily conicting Formality is a particularly imp ortant feature Motivation Programming languages are articial languages Programs written in them are used to control the execution of computers There are many programming languages in existence Some are simple intended for sp ecial purp oses others are complex and generalpurp ose for use in a wide variety of applications Even though programming languages lack many of the features of natural languages such as vagueness it is not at all easy to give accurate comprehensive descriptions of them Which applications require descriptions of programming languagesand hence motivate the study of appropriate frameworks for such descriptions First there is the programming language design pro cess Designers need to record decisions ab out particular language constructs esp ecially when the design is a team eort This amounts to giving a partial description of the language At a later stage the formulation of a complete language description may b e useful for drawing attention to neglected details and for revealing irregularities in the overall design Once a language has b een designed it usually gets implemented although in practice design and implementation are often interleaved and iterated A comprehensive description of the language is needed to convey the intentions of the language designers to the implementors unless the designer and the implementor are the same p erson of course It is also needed for setting a denitive standard for implementations so that programs can b e transp orted b etween dierent implementations that conform to the standard without mo dication A programmer needs a description of any new language in order to relate it to previously known ones and to understand it in terms of familiar concepts The programmer also needs a description as a basis for reasoning ab out the correctness of particular programs in relation to their sp ecications and for justifying program transformations Finally theoreticians can obtain new insight into the general nature of programming lan guages by developing descriptions of them This insight can then b e exploited in the design of new and p erhaps more elegant programming languages CHAPTER INTRODUCTION So we see that there are plenty of applications for descriptions of programming languages But not all kinds of description are suitable for all purp oses The various applications mentioned ab ove require dierent prop erties of descriptions as we consider next Requirements Which prop erties might language designers require of language descriptions Well design is an iterative pro cess so to start with designers need partial descriptions that can easily b e extended and mo died They also need descriptions that provide clear and concise do cumentation of individual language design decisions For economy of eort they might want to b e able to reuse parts of descriptions of existing languages in the description of a new language Finally their completed language description should provide an appropriate basis for conveying the design to the implementors and for setting standards The implementors of a language require a complete and unambiguous description of it except that certain features such as the order of sub expression evaluation may have b een delib erately left unsp ecied Explicit indication of implementation techniques in the description may b e helpful but it might discourage alternative p erhaps more ecient implementations Ideally the conformance of a purp orted implementation to a standard imp osed by a language description should b e veriable A longterm aim is to generate complete correct and ecient implementations automatically from language descriptions in the same way that parsers can b e generated from grammars There have already b een some encouraging exp eriments in this direction This application requires that the language descriptions can b e directly related to machine op eration What do programmers require A language description should b e easy to understand and to relate to familiar programming concepts without a ma jor investment of eort in learning ab out the description technique itself It should supp ort program verication And it shouldnt take up to o much space on the shelf Theoreticians may require clear and elegant foundations for the exploited description tech nique to supp ort tractable reasoning ab out equivalence and other program features They may take a prescriptive view of language description considering only a restricted class of program ming languagesthose amenable to their favourite description techniquein the hop e that this will prevent

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    53 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us