PASCAL on EMAS -------------- CONTENTS 1. INTRODUCTION 2. COMPILATION 2.1 Compilation Options 2.2 Compilation Listings 3. EXECUTION 3.1 Use of Input and Output Media 3.2 The Standard PASCAL Files INPUT and OUTPUT 3.3 Separate Compilation of PASCAL Procedures and Functions 3.4 Mixed Language Programming 4. BASIC ERROR ACTION 4.1 Compiler-detected Errors 4.2 Hardware Errors 4.3 Errors in Mathematical Libraries 4.4 Compile-time Control 4.5 Restrictions and Limitations 5. EMAS 2900 PASCAL 5.1 Lexical Conventions 5.2 Language Restrictions 5.3 Language Extensins 5.4 The Program Heading and External Files 5.5 Hardware Representation 5.6 The Standard Procedure WRITE Appendix 1 Compilation error messages Appendix 2 Execution Error Messages 1. INTRODUCTION The 2900 PASCAL Compiler is based on the "PASCAL User Manual and Report" (2nd Edition) by Kathleen Jensen and Nicklaus Wirth. The language implemented conforms to the standard defined in that work, subject to the restrictions, extensions and further specifications contained in subsequent sections of this documentation. The EMAS 2900 PASCAl compiler was developed by Southampton University and is distributed by ICL. PASCAL version 20 is currently in use. 2. COMPILATION The command used to compile a PASCAL source program is PASCAL(,/.NULL,/.NULL) The three parameters are: 1. The name of the source file containing the program or routines to be compiled. Several files can be concatenated with the "+" operator; for example A+B+C. 2. The name of the object file to be generated by the compiler. If a file of the given name exists it will be overwritten, if not a file will be created. The keyword .NULL is a valid alternative if no object file is required. This is a useful facility if the program is known to contain faults, since it reduces the compilation time. Note that this parameter cannot be a member of a partitioned file. An object file can, however, be copied into a partitioned file and used from there. 3. The name of a listing file or device. If this parameter is omitted a file created by the Subsystem with the name T#LIST will be used. Valid alternatives include output devices. Again, .NULL can be used if no listing is required. Note that T#LIST is destroyed when the user logs off, and is overwritten if used in another compilation in the current session. eg. PASCAL(PTEST,PTESTY,.OUT) 2.1 Compilation Options The user can control various aspects of the PASCAL compilation process by specifying values for compilation options. In all cases a default setting is assumed by the compiler if no other value is explicitly specified. There are two classes of compilation options: 1. Global Options - These are options whose settings are effective throughout the compilation process. Consequently their values must be fixed at the beginning of the compilation. 2. Local Options - These are options whose setting may be changed from time to time during the compilation process, i.e. at different points in the program source. Some options are both local and global. In this case, the global setting specifies whether or not the particular facility is required at all and, if so, the local setting specifies whether or not the facility is required at any particular point in the program source. Settings for global options may be specified in two ways: 1. By a call of the PARM command. 2. By global PASCAL-specific directives. In all cases, a setting is specified by actual or default parameters to the PARM command. A call of PARM takes effect for all future compilations until the user calls PARM again or logs off. PARM has the effect of resetting all values to the default settings, and then setting the ones selected, hence PARM with no parameters merely resets the defaults. The various PARM parameters relevant to PASCAL will be described in subsequent sections. If, in addition to the above settings, a specification for a particular option is made using a directive, this specification overrides that made by the PARM command. Note that a global diective must occur before the program heading. For local options, the method of changing settings from their initial states at the start of compilation is by use of local PASCAL-specific directives. The initial settings of local options are determined as follows: 1. For a local option that is not also a global option, the compiler automatically supplies an initial value. 2. For a local option that is also a global option - a) If the global setting is on, the initial local setting is on. b) If the global setting is off, the intial local setting is off. Note that for a local option that is also a global option, if the global setting is off, the local setting is permanently off, i.e. all relevant local directives are ignored. 2.1.1 PASCAL-specific Directives A PASCAL-specific directive occupies a single line of the source program and begins with the single character % in the first position. A PASCAL-specific directive line is not considered to be part of the source program as such, but the same lexical conventions apply in directives as in other PASCAL texts. Syntactically incorrect or misplaced directives are ignored. In a directive line, any text to the right of the directive proper and clearly separated from it, for example by blanks, will be ignored. The syntax of a directive depends on its status as global or local. A global directive takes the form: %