GSS-7.1 7. Library of Specification Modules A reusable specification modul * solves a frequently occurring task, e.g. name analysis according Algol-like scope rules, * provides abstract symbol roles (CLASS) with computations that contribute to the solution of the task, z. B. IdUseEnv for applied occurrences, * contains all specifications, functions, etc. that are necessary to implement the task's solution (FunnelWeb file) * is a member of a library of modules that support related topics, e.g. name analysis according to different scope rules * has a descriptive documentation Users * select a suitable module, * instantiate it, * let symbols of their abstract syntax inherit some of the symbol roles, * use the computed attributes for their own computations. (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 701 Objectives: Recognize reusable specification modules In the lecture: The topics of the slide are explained. -------------------------------------------------------------------------------- GSS-7.2 Basic Module for Name Analysis Symbol roles: Instantiation Grammar root: in a .specs file SYMBOL Program INHERITS RootScope END; for Algol-like scope rules: Ranges containing definitions: $/Name/AlgScope.gnrc:inst SYMBOL Block INHERITS RangeScope END; for C-like scope rules: Defining identifier occurrence: $/Name/CScope.gnrc: inst SYMBOL DefIdent INHERITS IdDefScope END; Applied identifier occurrence: for a new name space SYMBOL UseIdent $/Name/AlgScope.gnrc INHERITS IdUseEnv,ChkIdUse END; +instance=Label Provided attributes: :inst DefIdent, UseIdent: Key, Bind Symbol roles: Program, Block: Env LabelRootScope, LabelRangeScope, ... (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 702 Objectives: Get an idea of a particular specification module In the lecture: * The module and its variants are explained. * The documentation is shown. * The module is shown. -------------------------------------------------------------------------------- GSS-7.4 Specification Libraries in Eli Contetnts of the Eli Documentation Specification Module Library: * Introduction of a running example * How to use Specification Modules * Name analysis according to scope rules * Association of properties to definitions * Type analysis tasks * Tasks related to input processing * Tasks related to generating output * Abstract data types to be used in specifications * Solutions of common problems * Migration of Old Library Module Usage (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 704 Objectives: Overview over library themes In the lecture: The themes are explained. -------------------------------------------------------------------------------- GSS-7.5 Name Analysis, Type Analysis Name analysis according to scope rules Type analysis tasks * Tree Grammar Preconditions * Types, operators, and indications * Basic Scope Rules, 3 variants: * Typed entities Algol-like, C-like, Bottom-Up * Expressions * Predefined Identifiers * User-defined types * Joined Ranges (3 variants) * Structural type equivalence * Scopes being Properties of Objects (4 variants) * Error reporting in type analysis * Inheritance of Scopes (3 variants) * Dependence in type analysis * Name Analysis Test * Environment Module (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 705 Objectives: Overview over modules In the lecture: Purposes of the modules are explained. -------------------------------------------------------------------------------- GSS-7.6 Association of Properties to Entities Association of properties to definitions * Common Aspects of Property Modules * Count Occurrences of Objects * Set a Property at the First Object Occurrence * Check for Unique Object Occurrences * Determine First Object Occurrence * Map Objects to Integers * Associate Kinds to Objects * Associate Sets of Kinds to Objects * Reflexive Relations Between Objects * Some Useful PDL Specifications (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 706 Objectives: Overview over modules In the lecture: Purposes of the modules are explained. -------------------------------------------------------------------------------- GSS-7.7 Input and Output Tasks related to input processing Tasks related to generating output * Insert a File into the Input Stream * PTG Output for Leaf Nodes * Accessing the Current Token * Commonly used Output patterns for PTG * Command Line Arguments for * Indentation Included Files * Output String Conversion * Pretty Printing * Typesetting for Block Structured Output * Processing Ptg-Output into String Buffers * Introduce Separators in PTG Output (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 707 Objectives: Overview over modules In the lecture: Purposes of the modules are explained. -------------------------------------------------------------------------------- GSS-7.8 Other Useful Modules Abstract data types Solutions of common problems to be used in specifications * Lists in LIDO Specifications * String Concatenation * Linear Lists of Any Type * Counting Symbol Occurrences * Bit Sets of Arbitrary Length * Generating Optional Identifiers * Bit Sets of Integer Size * Computing a hash value * Stacks of Any Type * Sorting Elements of an Array * Mapping Integral Values To * Character string arithmetic Other Types * Dynamic Storage Allocation (c) 2012 bei Prof. Dr. Uwe Kastens -------------------------------------------------------------------------------- Lecture Generating Software from Specifications SS 2012 / Slide 708 Objectives: Overview over modules In the lecture: Purposes of the modules are explained. --------------------------------------------------------------------------------