Programming Language Eulisp
Total Page:16
File Type:pdf, Size:1020Kb
Programming Language Eulisp Version 0.99 Programming Language EuLisp, version 0.99 Contents Page Foreword :::::::::::::::::::::::::::::::::::::::::::::::::: 1 Introduction ::::::::::::::::::::::::::::::::::::::::::::::: 2 1 Language Structure :::::::::::::::::::::::::::::::::::::: 2 2 Scope :::::::::::::::::::::::::::::::::::::::::::::::::: 3 3 Conformance Definitions :::::::::::::::::::::::::::::::::: 3 4 Error Definitions :::::::::::::::::::::::::::::::::::::::: 3 5 Compliance ::::::::::::::::::::::::::::::::::::::::::::: 4 6 Conventions :::::::::::::::::::::::::::::::::::::::::::: 4 6.1 Layout and Typography ::::::::::::::::::::::::::::::::: 4 6.2 Meta-Language :::::::::::::::::::::::::::::::::::::::: 6 6.3 Naming ::::::::::::::::::::::::::::::::::::::::::::: 6 7 Definitions :::::::::::::::::::::::::::::::::::::::::::::: 6 8 Syntax ::::::::::::::::::::::::::::::::::::::::::::::::: 9 8.1 Whitespace and Comments ::::::::::::::::::::::::::::::: 9 8.2 Objects ::::::::::::::::::::::::::::::::::::::::::::: 9 9 Modules :::::::::::::::::::::::::::::::::::::::::::::::: 10 9.1 Directives :::::::::::::::::::::::::::::::::::::::::::: 10 9.2 Export Directive ::::::::::::::::::::::::::::::::::::::: 10 9.3 Import Directive ::::::::::::::::::::::::::::::::::::::: 10 9.4 Expose Directive :::::::::::::::::::::::::::::::::::::: 11 9.5 Syntax Directive ::::::::::::::::::::::::::::::::::::::: 11 9.6 Definitions and Expressions :::::::::::::::::::::::::::::: 11 9.7 Module Processing ::::::::::::::::::::::::::::::::::::: 12 9.8 Module Definition :::::::::::::::::::::::::::::::::::::: 12 10 Objects :::::::::::::::::::::::::::::::::::::::::::::::: 13 10.1 System Defined Classes :::::::::::::::::::::::::::::::::: 13 10.2 Single Inheritance :::::::::::::::::::::::::::::::::::::: 14 10.3 Defining Classes ::::::::::::::::::::::::::::::::::::::: 14 10.4 Defining Generic Functions and Methods ::::::::::::::::::::: 15 10.5 Specializing Methods ::::::::::::::::::::::::::::::::::: 17 10.6 Method Lookup and Generic Dispatch :::::::::::::::::::::: 18 10.7 Creating and Initializing Objects ::::::::::::::::::::::::::: 18 10.8 Accessing Slots :::::::::::::::::::::::::::::::::::::::: 19 11 Concurrency :::::::::::::::::::::::::::::::::::::::::::: 19 11.1 Threads ::::::::::::::::::::::::::::::::::::::::::::: 20 11.2 Locks ::::::::::::::::::::::::::::::::::::::::::::::: 21 12 Conditions :::::::::::::::::::::::::::::::::::::::::::::: 22 12.1 Condition Classes :::::::::::::::::::::::::::::::::::::: 22 12.2 Condition Handling :::::::::::::::::::::::::::::::::::: 24 ii Programming Language EuLisp, version 0.99 13 Expressions, Definitions and Control Forms :::::::::::::::::: 26 13.1 Simple Expressions ::::::::::::::::::::::::::::::::::::: 26 13.2 Functions: creation, definition and application ::::::::::::::::: 27 13.3 Destructive Operations :::::::::::::::::::::::::::::::::: 28 13.4 Conditional Expressions ::::::::::::::::::::::::::::::::: 29 13.5 Variable Binding and Sequences ::::::::::::::::::::::::::: 30 13.6 Events :::::::::::::::::::::::::::::::::::::::::::::: 33 13.7 Quasiquotation Expressions :::::::::::::::::::::::::::::: 33 13.8 Summary of Level-0 Expressions and Definitions ::::::::::::::: 34 13.8.1 Syntax of Level-0 defining forms :::::::::::::::::::::: 34 13.8.2 Syntax of Level-0 expressions :::::::::::::::::::::::: 35 13.8.3 Syntax of Level-0 macros ::::::::::::::::::::::::::: 35 Annexes A Level-0 Module Library ::::::::::::::::::::::::::::::::::: 37 A.1 Characters ::::::::::::::::::::::::::::::::::::::::::: 37 A.2 Collections ::::::::::::::::::::::::::::::::::::::::::: 39 A.3 Comparison :::::::::::::::::::::::::::::::::::::::::: 43 A.4 Conversion ::::::::::::::::::::::::::::::::::::::::::: 45 A.5 Copying ::::::::::::::::::::::::::::::::::::::::::::: 46 A.6 Double Precision Floats ::::::::::::::::::::::::::::::::: 47 A.7 Elementary Functions ::::::::::::::::::::::::::::::::::: 49 A.8 Floating Point Numbers ::::::::::::::::::::::::::::::::: 51 A.9 Fixed Precision Integers ::::::::::::::::::::::::::::::::: 52 A.10Formatted-IO ::::::::::::::::::::::::::::::::::::::::: 53 A.11Integers ::::::::::::::::::::::::::::::::::::::::::::: 55 A.12Lists :::::::::::::::::::::::::::::::::::::::::::::::: 56 A.13Numbers :::::::::::::::::::::::::::::::::::::::::::: 59 A.14Streams ::::::::::::::::::::::::::::::::::::::::::::: 62 A.15Strings :::::::::::::::::::::::::::::::::::::::::::::: 66 A.16Symbols ::::::::::::::::::::::::::::::::::::::::::::: 68 A.17Tables :::::::::::::::::::::::::::::::::::::::::::::: 70 A.18Vectors :::::::::::::::::::::::::::::::::::::::::::::: 71 A.19Syntax of Level-0 objects :::::::::::::::::::::::::::::::: 72 B Programming Language EuLisp, Level-1 ::::::::::::::::::::: 74 B.1 Classes and Objects :::::::::::::::::::::::::::::::::::: 74 B.2 Generic Functions :::::::::::::::::::::::::::::::::::::: 75 B.3 Methods ::::::::::::::::::::::::::::::::::::::::::::: 76 B.4 Object Introspection :::::::::::::::::::::::::::::::::::: 78 B.5 Class Introspection ::::::::::::::::::::::::::::::::::::: 78 B.6 Slot Introspection :::::::::::::::::::::::::::::::::::::: 79 B.7 Generic Function Introspection :::::::::::::::::::::::::::: 79 B.8 Method Introspection ::::::::::::::::::::::::::::::::::: 80 B.9 Class Initialization ::::::::::::::::::::::::::::::::::::: 81 B.10Slot Description Initialization ::::::::::::::::::::::::::::: 82 B.11Generic Function Initialization :::::::::::::::::::::::::::: 82 B.12Method Initialization ::::::::::::::::::::::::::::::::::: 83 B.13Inheritance Protocol :::::::::::::::::::::::::::::::::::: 83 B.14Slot Access Protocol :::::::::::::::::::::::::::::::::::: 87 B.15Method Lookup and Generic Dispatch :::::::::::::::::::::: 91 B.16Low Level Allocation Primitives ::::::::::::::::::::::::::: 92 B.17Dynamic Binding :::::::::::::::::::::::::::::::::::::: 93 B.18Exit Extensions ::::::::::::::::::::::::::::::::::::::: 94 B.19Summary of Level-1 Expressions and Definitions ::::::::::::::: 95 B.19.1Syntax of Level-1 defining forms :::::::::::::::::::::: 95 B.19.2Syntax of Level-1 expressions :::::::::::::::::::::::: 95 B.19.3Syntax of Level-1 macros ::::::::::::::::::::::::::: 95 Indexes ::::::::::::::::::::::::::::::::::::::::::::::::::: 98 Class Index :::::::::::::::::::::::::::::::::::::::::::::: 98 Condition Index ::::::::::::::::::::::::::::::::::::::::::: 99 Constant Index ::::::::::::::::::::::::::::::::::::::::::: 100 Function Index :::::::::::::::::::::::::::::::::::::::::::: 101 Macro Index :::::::::::::::::::::::::::::::::::::::::::::: 102 Generic Function Index ::::::::::::::::::::::::::::::::::::: 103 Method Index :::::::::::::::::::::::::::::::::::::::::::: 104 iii Programming Language EuLisp, version 0.99 General Index :::::::::::::::::::::::::::::::::::::::::::: 105 Figures 1 Example of module directives :::::::::::::::::::::::::::::::: 11 2 Example module using expose ::::::::::::::::::::::::::::::: 11 3 Level-0 initial class hierarchy :::::::::::::::::::::::::::::::: 13 4 Level-0 initial condition class hierarchy ::::::::::::::::::::::::: 23 5 Illustration of handler actions ::::::::::::::::::::::::::::::: 25 6 Example using let/cc ::::::::::::::::::::::::::::::::::::: 31 7 Interaction of unwind-protect with non-local exits :::::::::::::::: 33 A.1 Level-0 number class hierarchy ::::::::::::::::::::::::::::::: 59 B.1 Level-1 class hierarchy ::::::::::::::::::::::::::::::::::::: 78 B.2 Initialization Call Structure ::::::::::::::::::::::::::::::::: 82 Tables 1 Modules comprising eulisp-level-0 :::::::::::::::::::::::::: 3 2 Minimal character set ::::::::::::::::::::::::::::::::::::: 9 3 Syntax of objects for reading and writing ::::::::::::::::::::::: 9 4 Module syntax ::::::::::::::::::::::::::::::::::::::::::: 12 5 defstruct syntax :::::::::::::::::::::::::::::::::::::::: 14 6 defgeneric rewrite rules ::::::::::::::::::::::::::::::::::: 16 A.1 Character Syntax ::::::::::::::::::::::::::::::::::::::::: 37 A.2 Summary of comparison functions :::::::::::::::::::::::::::: 44 A.3 Floating Point Syntax ::::::::::::::::::::::::::::::::::::: 51 A.4 Integer Syntax ::::::::::::::::::::::::::::::::::::::::::: 55 A.5 Pair and List Syntax :::::::::::::::::::::::::::::::::::::: 56 A.6 Examples of string literals :::::::::::::::::::::::::::::::::: 66 A.7 String Syntax ::::::::::::::::::::::::::::::::::::::::::: 66 A.8 Identifier/Symbol Syntax ::::::::::::::::::::::::::::::::::: 69 A.9 Vector Syntax ::::::::::::::::::::::::::::::::::::::::::: 71 iv COMMITTEE DRAFT Programming Language EuLisp, version 0.99 Programming Language EuLisp, version 0.99 In the beginning, the work of the EULISP group was sup- ported by the institutions or companies where the partici- pants worked, but in 1987 DG XIII (Information technol- ogy directorate) of the Commission of the European Com- munities agreed to support the continuation of the work- ing group by funding meetings and providing places to meet. It can honestly be said that without this support EULISP would not have reached its present state. In ad- dition, the EULISP group is grateful for the support of: British Council in France (Alliance programme), British Council in Spain (Acciones Integradas programme), British Council in Germany (Academic Research Collaboration pro- gramme), British Standards Institute, Deutscher Akademis- cher Austauschdienst (DAAD), Departament de Llenguat- ges i Sistemes Inform`atics(LSI, Universitat Polit`ecnicade Catalunya), Fraunhofer Gesellschaft Institut f¨urSoftware Foreword und Systemtechnik, Gesellschaft f¨urMathematik und Daten- verarbeitung (GMD), ILOG S.A., Insiders GmbH, Institut The