PLN 1

INTRODUCTION

TO

PLASYD

A language for software production for the 1900 series computers

Version: 3 August 1968

1. General

The language is designed to allow any machine code facilities to be exploited. However, some aspects of the order code are made easier to use, sometimes at a slight cost in efficiency, sometimes with no penalty. In general more effort is made to simplify flow of control that data manipulation, over which the user has more direct control.

Within the limits imposed by the first design aim the second aim is readability. The syntax of the language is Algol-like though much simpler and no run time stack is required. In addition the 'fixed word symbols' of Algol are replaced by reserved words so that spaces become significant, In certain cases the need. for readability requires that certain non-significant characters be written and punched (to the annoyance of programmers and punch girls). As a compromise, during transfer to disc, full and reduced forms of certain fixed symbols are allowed (e.g. INT for INTEGER) but the full form is always listed. Comments may appear anywhere between symbols and identifiers and will be ignored. ( In fact if a symbol input routine is used, which seems sensible, comments could even appear within identifiers).

The compiline system must have the ability to separately compile segments which are procedures and to later consolidate such segments to make a program which can possibly be overlaid. Decisions on overlaying and the incorporation of common store areas into overlays are delayed until consolidate time.

2. The Compiling Svstem

The PLASYD compiler must produce normal semi-compiled output (possibly with minor modifications) and this must be capable of being consolidated and possibly overlaid in the normal way. Compilation is to be one segment at a time and, if possible the whole segment should be held in store at one time, minicompiler fashion. This will greatly simplify the processing of FOR loops and forward jumps but is not essential. Input to the compiler should be from slow peripheral or disc. The compiling system must be capable of reading a complete set of segments from one disc file and producing a corresponding semi-compiled file. The compiler must be interfaced with a consolidator and an editor program in such a way that the following sequence of operations is provided automatically on receipt of some parameters:-

  1. The source segments held on a disc file are selectively replaced or amended or added to, according to slow peripheral parameters, from a slow peripheral or source segments in other files.
  2. The changed or added segments are compiled and the output (optionally) replaces segments of, or is added to, the semi-compiled file. A listing of recompiled segments is produced.
  3. The semi-compiled file is selectively or totally consolidated according to overlay information stored in a standard steering segment or according to new information from slow peripherals which can optionally replace the stored information. Consolidation details are listed.
  4. The newly consolidated program is optionally run with trial data. In order to provide complete flexibility it is probably advantageous to produce a simple minded compiler and to have the edit/compile/consolidate/run sequence master-minded by a trusted program (R.C.T.P. so it can run on the 1903).

3. Code Generated

The compiler itself must be written in 15AM, DBM using the basic instruction set (1903 type) and may assume a 32K store for itself and the trusted program. The object program produced must be in one of four modes, set by switches or parameters as under:-

  1. Either 15am or 22am, DBM and basic instruction set
  2. Either 15am or 22am, DBM and simulated extended set
  3. 22am, DBM and extended instruction set
  4. 22am, EBM and extended instruction set.

Mode 2 is to be used only for testing programs to be finally produced in mode 3. The extra instructions available (MVCH, SMO etc) are simulated. by macros. Mode 4 is not necessary for the initial version. Mode 1 should be implemented first and the others bootstrapped. This will provide a test of the facilities available.

The form of the language is such that the code may be as optimised as the programmer wishes e.g.

            X1 ← X1 + F  is compiled as  ADX   1   F
while       X1 ← F1 + X1 is compiled as  LDX   1   F
                                         ADX   1   1

and means aomething quite different.

In cases where more control is needed over the instructions generated, facilities are available for the insertion into program or data of all machine orders in a pseudo functional form.

4. Pros and Cons

The advantages of PLASYD over PLAN are:-

  1. It is more easily readable and therefore easier to document and maintain.
  2. Many of the chores associated with flow of control are removed from the programmer.
  3. With no customer pressures we can build an editing/compiling/operating system more suitable to our needs than the PLAN systems.
  4. We can from inception incorporate the :EMA functional language (see 6).

The disadvantages compared with PLAN are:-

  1. PLAN exists, PLASYD doesn't.
  2. Many people are already familiar with PLAN.

The first of these is slightly offset by the fact that even with PLAN we might have to design an operating system of our own for use with large projects.

The adva_ntages of PLASYD over a higher level language are:-

  1. Being machine dependent it produces efficient code with little bother.
  2. Its syntax is designed for ease of implementation i.e. much of the grammar is context free and is restrictive enough to allow in most cases only one way of doing something.
  3. It can be implemented much faster than a new high level language and no existing h.l.l. is suitable.

The disadvantage compared with a h.l.l. is:-

  1. Being machine dependent it is not transferable to another machine.

5. General form of the language

A unit for compilation consists of a program or a segment. A segment takes the form of a procedure which can be called from other segments without previous declaration {FORTRAN style). Procedures have no parameters but specify their link accumulator and common information may be left in accumulators, common (global) areas, or in the case of procedures which are not separate segments, in variable space.

A segment begins with

             PROCEDURE <identifier> (<link>); BEGIN

or just plain BEGIN for a non-procedure segment.

Segments consist of: a block, that is a BEGIN followed by declarations followed by statements followed by END, and blocks may be nested. This enables the compiler to share storage between variables in different blocks where possible. Recursion is not explicitly permitted and must be provided for by the programmer.

Declarations serve to give names to storage cells which may be 24. bits, 48 bits or 96 bits long and to assign aynonyms to accumulators. A special set of declarations are available to ensure that certain named cells are in LOWER store or in GLOBAL blocks. Global blocks are storage which may be common to the routines of one overlay unit {OVERCOMMON) or to the whole program (COMMON PERMANENT) the distinction being defined at consolidate time.

A convention for upper store addressing has been adopted which attempts to minimise the amount of lower store used for literals. This allows upper storage cells to be grouped together into "domains" the address of the first cell being stored in LOWER storage and forming the "base" of the domain. The address @A of any cell A in upper storage is given by the sum of its base £A and its displacement from the base $A. Domains are limited to 4096 words so that $A can always be expressed in 12 bits. For quantities in lower £A is zero and $A is the word address. To address characters whether in upper or lower a modifier (or SMO) must always be used.

Arithmetic and logical operations with real and integer operands are expressed by assignment statements

    X1 ← A + B/C + D*3 

which are executed in strict left to right order. Beside the normal arithmetic operations shift operators etc. are available. Parts or the data may be declared as arrays and references may be made to array elements:-

    X2 ← A(X1+3) 

The complexity of the index allowed depends on whether or not SMO is available in the current output mode. In the case of arrays in upper storage the array name implies $A and it is assumed that the programmer has placed #163;A in the modifier register already. An attempt to address A directly without the use of a modifier or supplementary modifier will be flagged.

Flow of control is handled by

    GO TO statements - unconditional jumps 
    OBEY statements  - Execute one statement out of line 
    CASE statements  - Execute one of several out of line statements
    FOR statements   - incremental loops 
    WHILE statements - conditional loops 
    Procedure calls. 

Variables may be given initial values which they will have on initial loading and any subsequent reloading caused by the overlay system. Variabls not so assigned have undefined values on loading or reloading. Only GLOBAL store which is placed by the consolidator in permanent can be relied upon to retain information from one overlay call to another.

The EMA functional language

This is the system used for tree analysis and code generation in the 1900 and ORION E.M.A. compilers. For this particular purpose it is a very powerful tool though it is not so useful in the remainder of the compiler or in non-compiler programs (e.g. run time routines) which could be produced in PLASYD. It therefore seems convenient to incorporate the functional language into the PLASYD compiler in some sense. More details are given in Appendix to PLASYD Syntax and Notes.

J.K. Buckle

680621

Modified
680729
680813