Download VDMTools®
Transcript
The VDM++ to Java Code Generator Contents 1 Introduction 1 2 The 2.1 2.2 2.3 Code Generator - Getting Started Generating Code Using the VDM++ Toolbox . . . . . . . . . . . . . . . Interfacing the Generated Code . . . . . . . . . . . . . . . . . . . . . . . Compiling and Running the Java Code . . . . . . . . . . . . . . . . . . . 2 2 4 7 3 The 3.1 3.2 3.3 3.4 Code Generator - Advanced Issues Options of the VDM++ to Java Code Generator . . . . . . . . . . . . . Implementing Implicit and Preliminary Functions/Operations . . . . . . Generation of Abstract Classes . . . . . . . . . . . . . . . . . . . . . . . Substituting Parts of the Generated Java Code . . . . . . . . . . . . . . 3.4.1 Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.2 Rules for keep tags . . . . . . . . . . . . . . . . . . . . . . . . . . Generating Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 Requirements of VDM++ specifications due to language differences 3.6.2 Unsupported Constructs . . . . . . . . . . . . . . . . . . . . . . . 9 9 12 14 16 18 18 19 22 23 26 3.5 3.6 4 Code Generating VDM++ Specifications 4.1 The VDM Java Library . . . . . . . . . . . . . . . . . . 4.2 Code Generating Classes . . . . . . . . . . . . . . . . . . 4.3 Inheritance Structure of the Generated Java Classes . . 4.4 Code Generating Types . . . . . . . . . . . . . . . . . . 4.4.1 Mapping Anonymous VDM++ Types to Java . . 4.4.2 Mapping VDM++ Type Definitions to Java . . . 4.4.3 Invariants . . . . . . . . . . . . . . . . . . . . . 4.5 Code Generating Values . . . . . . . . . . . . . . . . . . 4.6 Code Generating Instance Variables . . . . . . . . . . . 4.7 Code Generating Functions and Operations . . . . . . . 4.7.1 Explicit Function and Operation Definitions . . . 4.7.2 Preliminary Function and Operation Definitions 4.7.3 Implicit Function and Operation Definitions . . . 4.7.4 Pre and Post Conditions . . . . . . . . . . . . . . 4.8 Code Generating Expressions and Statements . . . . . . 4.9 Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 29 30 32 35 35 38 41 41 43 44 45 45 45 46 46 46 5 Code Generation of Concurrent VDM++ Specifications 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Code Generation . . . . . . . . . . . . . . . . . . . . 5.3 Translation Approach . . . . . . . . . . . . . . . . . . . . . 5.3.1 Core Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 47 47 47 47 48 . . . . . . . . . . . . . . . . i