DataMuseum.dk

Presents historical artifacts from the history of:

CR80 Wang WCS documentation floppies

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CR80 Wang WCS documentation floppies

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦4bb017e8d⟧ Wang Wps File

    Length: 42641 (0xa691)
    Types: Wang Wps File
    Notes: CPS/TMA/014     (Week 15) 
    Names: »2975A «

Derivation

└─⟦68258fd9d⟧ Bits:30006163 8" Wang WCS floppy, CR 0232A
    └─ ⟦this⟧ »2975A « 

WangText

…00……00……00……00……00……00……00……00……00…8…02…8 8…05…7…08…7…0b…7…0e…7…01…7 7…07…6…0a…6…0d…6…00……86…1         …02…   …02…   …02…   …02…                                           





   Instructors Manual for
   RST Course, Week 15


   CPS/TMA/014
   Line Item 8.2.4.2













   Birthe Irgens      




   Kurt Nybroe-Nielsen







   SHAPE (3), NCS (1), ORP, PBP, CL, JJD,
   BSP, KJA, Conf.Mgmt.















        ILS Train.MGT.  821102


  Preliminary



  821102



…02…  CPS/TMA/014

…02…  JJD/821102…02… 
 INSTRUCTORS MANUAL FOR RST COURSE,
 WEEK 14                                     …02…  CAMPS














          821102              All      Prelim. Issue of Document



…0e…                                                2975A/ktd 

                                                BI/821102     
                                         
      Introduction to Progr.   15:1:1   45                 CAMPS…0f…





                   Describe the main purpose of the language design
                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                            
                   OH, Whiteboard 
                                        


                   SWELL Reference Manual
                                   

                    



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      SWELL Structure          15:1:2   45           
      CAMPS…0f…





                   Describe the SWELL structure

                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                            
                   OH, Whiteboard 
                                        


                   SWELL Reference Manual
                                   

                    



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      Program Module           15:1:3   45           
      CAMPS…0f…





                   Describe the program module and the subblock elements
                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                            
                   OH, Whiteboard 
                                        


                   SWELL Reference Manual
                                   

                    



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      Constant & Type Defin.   15:1:4   45           
      CAMPS…0f…





                   Define constants and types 

                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                            
                   OH, Whiteboard 
                                        


                   SWELL Reference Manual
                                   

                    



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      Decl. & Denot. of Var.   15:1:5     45         
        CAMPS…0f…





                   Declare variables          
                   Use the MON-procedures
                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                            
                   OH, Whiteboard 
                                        

                   SWELL Reference Manual
                   AMOS I/O System Manual
                   AMOS Kernel Manual



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      SWELL Compiler & Ex. 1   15:1:6     180        
        CAMPS…0f…





                   Use the SWELL compiler     
                   Write a simple SWELL program
                    
                   








                   Exercise  
                                                    
                                                      










                   CAMPS Classroom      
                   Computerroom







                   Group Work and Lecture            



                            
                   OH, Whiteboard 
                   HO                   


                   SWELL Compiler Manual
                   SWELL Reference Manual



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      Linker                   15:2:4     45         
        CAMPS…0f…





                   Use the LINKER             
                   
                   
                   








                   Exercise  
                                                    
                                                      










                   CAMPS Classroom      
                   Computerroom







                   Lecture            



                            
                    
                   HO                   



                   SWELL Reference Manual



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      EXPRESSION               15:2:5   45           
      CAMPS…0f…





                   Use the expressions        

                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                   OH
                      
                                        


                   SWELL Reference Manual
                                   

                    



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      STATEMENTS               15:2:6   90           
      CAMPS…0f…





                   Use the SWELL Statements   

                    
                   








                   "Situation questions" during the lesson
                                                    
                                                      










                   CAMPS Classroom      








                   Lecture            



                   OH, Whiteboard
                      
                                        


                   SWELL Reference Manual
                                   

                    



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      SWITCH MON               15:3:2     180        
        CAMPS…0f…





                   Use the SWITCH MON statement











                   "Situation questions" and exercise 2
                                                    
                                                      










                   CAMPS Classroom      
                   Computerroom







                   OH, HO                            



                   Whiteboard, OH




                   SWELL Reference Manual



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      VARIABLE INIT            15:3:6     180        
        CAMPS…0f…





                   Use the initialization of variables and
                   multiply and divide










                   "Situation questions" and exercise 3
                                                    
                                                      










                   CAMPS Classroom      
                   Computerroom







                   OH, HO                            



                   Whiteboard, OH




                   SWELL Reference Manual



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      Procedures               15:4:4     135        
        CAMPS…0f…





                   Write procedures











                   Exercise 4
                                                    
                                                      










                   CAMPS Classroom      
                   Computerroom







                   Lecture                           
                   Groupwork


                   OH, HO




                   SWELL Reference Manual



…0e…                                                2975A/ktd
 

                                                BI/821102
     
                                         
      Dedicated Statement      15:5:1     225        
        CAMPS…0f…





                   Use the dedicated statement











                   Situation question
                   Exercise 5                       
                                                      










                   CAMPS Classroom      
                   Computerroom







                   Lecture and Group work            
                            


                   OH, HO




                   SWELL Reference Manual


                                                  2975A/ktd
  

                                                  15:1:1
   BI/821102

           Introduction to Programming            L  
  





SWELL         OH 1      S̲oftware E̲ngineering L̲ow-Level L̲anguage

                        SWELL includes a large number of the program
                        and data facilities of Pascal.

Main purpose of
the language
design                  The main purpose was to enable the programmer
                        to create very effective object programs
                        in a well structured manner.

                        The performance and resource requirements
                        of SWELL programs are comparable to the corresponding
                        figures for assembly language programs.

                        Key words: Low level language
                                   Program performance
                                   Structured programming
                                   System programming language



SWELL/Pascal            SWELL differs from Pascal in some essential
                        points:

                        1)  SWELL does not hide the actual computer
                            from the programmer.

                            The virtual computer is identical to
                            the actual computer, and the programmer
                            controls register usage, addressing techniques,
                            etc.

                        2)  SWELL does not include any kind of run
                            time system.

                            There are no run time facilities for
                            maintaining a valiable stack, for parameter
                            transfer, etc. 

                            No general purpose registers or variables
                            are allocated or used behind the programmer's
                            back.

                        3)  SWELL does not define a closed, self
                            contained world. 

                            Instead, SWELL allows direct access to
                            system software modules.



                                                  2975A/ktd  

                                                  15:1:1   BI/821102

           Introduction to Programming            L    





The CR 80
Computer                16 bit minicomputer manufactured by CR.

                        The code and data parts of a program are
                        separated, each part being referenced relative
                        to its own base register. 

                        Addresses are primarity word addresses (access
                        to 64K words of code and 64K of data).

Registers               8 general purposes, 16 bits registers used
                        for word operations or concatenated for double
                        word operations.

6 primary
addressing modes        1  register direct addressing
                        2  immediate addressing
                        3  code base relative addressing
                        4  data base relative addressing
                        5  program counter relative addressing
                        6  register indirect addressing (indexing)

INSTRUCTIONS            Single word instructions using the primary
                        addressing modes.

                        May be extended by adding the contents of
                        a "modifier" register.

Data types              Directly handled by the CR80 instructions:

                        1  bits (single bit or a sequence of bits)
                        2  bytes (8 bits)
                        3  words (16 bits)
                        4  double words (32 bits)

The instruction
set includes            1  arithmetic and logical operations on words
                        2  move operations on bits, bytes, words,
                           and double words
                        3  skip and jump instructions, performing
                           program sequence control

Operands                A CR80 instruction may address zero, one
                        or two operands.

                        In case of logic and arithmetic operations,
                        one of the source operands is used as destination
                        operand.

                        A number of instructions support memory to
                        memory operations.



                                                  2975A/ktd  

                                                  15:1:2   BI/821102

           SWELL Structure                        L    





SWELL Manual  CSS/415/
              RFM/0002  Modified Backus-Naur Form

 and                    According to traditional BNF, syntactic constructs
                        are denoted by English words enclosed between
                        the angular brackets.

                        These words also describe the meaning of
                        the construct and are used in the accompanying
                        description of semantics.

 and                    Possible repetition (or omission) of a construct
                        is indicated by enclosing the construct within
                        metabrackets.

 empty                  Denotes the null sequence of symbols.

 identifier             Is often replaced by more descriptive variants
                        like  type identifier,  label identifier
                        .

Special symbols         OH 1                  Delimiter symbols:

                        Her inds`ttes symboler





Reserved words          OH 2



Identifiers   OH 3      Identifiers are build up by letters, digits
                        and the underline symbol.

                        In identifiers a small letter and the corresponding
                        capital letter are not descriminated.

                        Examples:

                        ALFA, SAVERO, STING ̲POINTER, EXIT ̲4711



                                                  2975A/ktd  

                                                  15:1:2   BI/821102

           SWELL Structure                        L    





Numbers       OH 4      Two different notations are used for numbers
                        1) decimal and 2 hexadecimal notation.

                        The value of an unsigned number must belong
                        to the range:

                           0..65535  (decimal)
                           0..# FFFF (hexadecimal)

                        Examples: Legal numbers:

                        Decimal:     0001, 4711, 14, 00
                        Hexadecimal: #0001, #1267, #E, #00

Strings                 1) Consecutive string
                        2) Composed string

                        ad 1)

                        A sequence or characters prefixed and terminated
                        by single quote marks. A consecutive string
                        must not contain line terminating characters
                        (characters with ordinal values in the range
                        1 ot 31). Any character may be included in
                        a string by writing its ASCII value enclosed
                        in the character brackets (: and :).

Contatenations             Strings are concatenated by using the
                           catenation operator &.

                        Syntactically concatenated strings are regarded
                        as one single string.

Quote mark              The single quote mark may me used within
                        a string by writing it twice.

Short strings           Containing one or two characters

Long strings            containing more than two characters

Examples      OH 5      'ABC''XYZ
                        is equivalent to
                        'ABC(:39:)XYZ'
                        and equivalent to
                        …0e…AB' & 'C(:39:)X' & 'YZ'

Comments example        "THE REST OF THIS LINE IS A COMMENT
                        "MORE CODE MAY BE WRITTEN AFTER THIS COMMENT"



                                                  2975A/ktd  

                                                  15:1:3   BI/821102

           Program Module                         L    





Program Module          OH 1                  1)    Main module
              OH 2      2) Sub module

                        A program consists of one main module and
                        an optional number of submodules.

                        A program can only have one statement part.
                        This statement part is placed in the main
                        module of the program.

Subblock      OH 3      1) label declaration part
elements                2) constant definition part
                        3) type definition part
                        4) variable declaration part
                        5) variable initialization part
                        6) procedure declaration

Label         OH 4      The label declaration part specifies label
declaration             identifiers which mark a statement in the
part                    statement part.

Constant      OH 5      A constant definition part contains constant
definition              synonym definitions which are local to the
                        
part                    block.

Type          OH 6      A type definition part contains type 
definition              definitions which are local to the block.
part

Variable      OH 7      A variable declaration part contains
declaration             variable declarations local to the block.
part                    Variable declarations may be of the following
                        types:

                        1. allocation of permanent space for variables
                           within the data part (base relative part)
                           of the program. These variables may at
                           the same time be exported for external
                           use.

                        2. allocation of temporary space for variables
                           within the data part (base relative part)
                           of the program. All blocks share a common
                           pool of locations for temporary variables
                           (the same location may be used by many
                           procedures for different purposes and
                           it is up to the programmer to avoid conflicts).

                        3. import of variables, declared and allocated
                           in a foreign module.



                                                  2975A/ktd  

                                                  15:1:3   BI/821102

           Program Module                         L    





Variable      OH 8      A variable initialization part assigns
initialization             initial values to permanent variables.
part

Statement part          OH 9                  The statement part
                                              specifies the algorithmic
                                              actions to be execured
                                              upon an activation
                                              of a program or a procedure.



                                                  2975A/ktd  

                                                  15:1:4   BI/821102

           Constant and Type Definition           L    





Constant and 
type definition            Constant and type definitions are abstract
                           ways of describing the data structures
                           on which a program is to operate. They
                           result in no code generation and no allocation
                           of data space in the object program. Therefore,
                           SWELL has almost directly adopted these
                           program parts from PASCAL.

                        A difference from PASCAL is that an expression,
                        involving constant operands only, is considered
                        a constant and may be used to define other
                        constants.

Constant      OH 1      A constant definition introduces an
definition              identifier as a synonym to a constant.

Examples                CONST
                           LASTINDEX = N-1;
                           AREA      = LENGTH*WIDTH;
                           NL        = '(:10:)';
                           VERSION   = 'VERSION 1';

Data type     OH 2      Every variable is associated to a data type.
                        
definitions             The data type of a variable determines the
                        structure of the variable and the set of
                        values which the variable may assume.

Standard types

Byte                    An unsigned integer, which can be held in
                        one byte (8 bits) and therefore lies in the
                        range (0:255).

Char                    = Byte

Enteger                 Can be held in one word (16 bits). There
                        is no standard interpretation of this data
                        type. The interpretation depends on the operations
                        performed on variables of this type. But
                        normally INTEGERs are used as unsigned integers
                        or as signed integers using 2s-complement
                        arithmetic.



                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Constant and Type Definition           L    





Long                    Is an integer which can be held in a double
                        word (32 bits). 
                        As only a few operations on double word operands
                        are supported by the CR80 directly, the type
                        is 'predeclared' as:

                             LONG=
                               RECORD
                                 LEAST, MOST: INTEGER
                               END;

String                  Is an array, which can hold a number of chars.
                        The type is 'declared' as:

                        STRING = ARRAY  0..131  OF CHAR;

Scalar types  OH 3      A scalar type defines an ordered set of values
                        by enumeration of identifiers which denote
                        these values.

                        The base of a scalar type is integer, and
                        the values of the elements are equal to the
                        constants 0,1,2,...

Exampels                TYPE
                          BOOLEAN=(FALSE, TRUE);
                          WEEKDAYS=(MONDAY, TUESDAY, WEDNESDAY,
                                    THURSDAY, FRIDAY, SATURDAY,
                                    SUNDAY);

Subrange type OH 4      A type may be defined as a subrange of another
                        scalar type by indication of the least and
                        the largest value in the subrange. The first
                        constant specifies the lower bound, and must
                        not be greater than the upper bound.

Example                 TYPE
                           WORKDAY=MONDAY..FRIDAY;

TYPE DEF./
CONSTANT                The rules for type compatibility are much
                        more liberal in SWELL than in PASCAL. This
                        is due to the explicit use of registers.
                        Very few operations may be carried out without
                        involving registers, so it would be very
                        inconvenient, if the type of a register did
                        not match all other scalar and subrange types.



                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Constant and Type Definition           L    





                        The following definitions are therefore equivalent:

                        1) TYPE
                             WORKDAY= (MONDAY, TUESDAY, WEDNESDAY,
                                       THURSDAY, FRIDAY);

                        2) CONST
                             MONDAY   = 0;
                             TUESDAY  = 1;
                             WEDNESDAY= 2;
                             THURSDAY = 3;
                             FRIDAY   = 4;

                           TYPE
                             WORKDAY= MONDAY..FRIDAY;

                        Array types and record types may also be
                        defined in SWELL.

Structured    OH 5      A structured type is characterized by the
                        
types                   types of its components and by its structuring
                        method.

Array Types   OH 6      An array type is a structure consisting of
                        a fixed number of components, which are all
                        of the same type, called the component type.
                        The elements of the array are designed by
                        indices, values belonging to the so-called
                        index type.

                        The base of the index type must be INTEGER,
                        while the components may be of any type.
                        Arrays having component base type different
                        from BYTE, INTEGER or LONG, can only be indexed
                        by using constant indices.

                        An array type has the same base as another
                        array type, if the index types are equivalent,
                        and the components have the same base type.

Examples                   ARRAY  1..10  OF = 0000.. OFFF;
                           ARRAY  'A'..'Z'  OF INTEGER;
                           ARRAY  WEEKDAY  OF WORKHOURS;



                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Constant and Type Definition           L    





Record types  OH 7      A record type is a structure consisting of
                        a fixed number of components, possibly of
                        different types.
                        The record type definition specifies for
                        each component called a f̲i̲e̲l̲d̲, its type and
                        an i̲n̲d̲e̲n̲t̲i̲f̲i̲e̲r̲ which denotes it.
                        The scope of these field i̲d̲e̲n̲t̲i̲f̲i̲e̲r̲s̲ is the
                        record definition itself, and they are also
                        accessible within a field designator referring
                        to a record of this type.
                        A record may contain a fixed part and/or
                        a varible part.

                        A variable part is conceptually equivalent
                        to a set of overlayed subrecords, each of
                        which in turn may consist of a fixed part
                        and/or a variable part.

                        The size of a record including a variable
                        part is the sum of the fixed part size and
                        the size og the largest of the overlayed
                        subrecords in the variable part.

                        It is up to the user to handle the overlay
                        mechanism (keep track of visible variants
                        etc.)

                        The base of the component type must n̲o̲t̲ be
                        BYTE.

                        A record type has the same base as another
                        record type, if they are equivalent.

Examples                   DAYTYPE=
                             RECORD
                               DAY:   1..31;
                               MONTH: 1..12;
                               YEAR:  INTEGER
                           END;

                           PERSON=
                             RECORD
                               NAME: ARRAY  1..NAMELENGTH  OF CHAR;
                               BIRTHDAY: DAYTYPE
                             END;


                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Constant and Type Definition           L    






                           VARREC=
                             RECORD
                               VARIANTS:
                                 (SCH: SCHOOLTYPE;
                                   VARIANTS:
                                     (CLASS: INTEGER) !
                                     (FACULTY:INTEGER)
                                   END;) !
                                 (KINDERGARDEN: STRING)
                               END;
                             END;



                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Decl. & Denot. of var.                 L    





Declaration             Variables may be declared and initialized
                        in 
and denotation             SWELL.
of variables            But as no runtime system exists, allocation
                        of varibales is not performed dynamically.
                        Space for all declared variables is allocated
                        at compile time.
                        If a programmer wants another allocation
                        method, he has to implement it himself.

Declaration   OH 1      Variable declarations consist of a list of
                        identifiers denoting the variables, followed
                        by their type.

Examples                VAR
                           I, J: INTEGER;
                           L: LONG;
                           OPERATOR: (PLUS, MINUS, TIMES);
                           HASHTABLE: ARRAY  O..HASHSIZE-1  OF INTEGER;
                           CLASSTABLE: ARRAY  0..127  OF CLASSTYPE;

                        The base of the variable type must not be
                        byte.

Variable      OH 2      Denotations of variables either designate
                        a 
Denotations             register variable, an entire variable, a
                        component variable, a variable referenced
                        by a pointer, or a constant parameter record.

R0-R7         OH 3      The general purpose registers are predeclared
                        as variables of type INTEGER.

R01-R70                 The same variables may be used as variables
                        of type LONG.

                        In this case two registers are concatenated
                        and used as one variable.

Redefinition            The type of a register may be redefined to
                        another type with the same base type.

Entire        OH 5      An entire variable is denoted by its 
Variable                identifier. An entire variable is addressed
                        as a base relative operand, where no index
                        register is used. The address refers to the
                        first word of the variable.



                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Decl. & Denot. of var.                 L    





Component     OH 6      A component of a variable is denoted 
variable                by the variable followed by an selector specifying
                        the component.

Indexed       OH 7      A component of an array variable is denoted
                        
variable                by the variable followed by an index expression.

Field         OH 8      A component of a record is denoted by the
                        
designator              record variable followed by the field identifier
                        of the component.

Example                 L. LEAST;

Referenced    OH 9      The base type of the pointer operand must
                        be 
variable                integer.

                        The SWELL, the notation of a variable referenced
                        by a pointer differs from the notation used
                        in PASSCAL.
                        This is so because a pointer is not associated
                        with variables of a specific type.
                        In SWELL, pointers must therefore be qualified
                        explicitly when they are used.

Examples                R4  ENTRYTYPE;
                        R4  ENTRYTYPE.NEXT  INTEGER;
                        R4  DAYTYPE.MONTH;
                        P   INTEGER;

                        If a register is used as a pointer variable,
                        a referenced variable may be addressed in
                        a very efficient way on a CR80, as the addressing
                        may be performed by an index register.



                                                  2975A/ktd  

                                                  15:1:5   BI/821102

           Decl. & Denot. of var.                 L    





Standard      OH 10     A standard procedure MON is predeclared in
                        
procedure               the implementation of SWELL. This procedure
                        
MON                     is intended for calling system procedures
                        via the MON instruction. The procedure differs
                        from procedures declared in SWELL programs
                        because:

                           - R7 is used as link register (optional)
                           
                             (usually only R4, R5 and R6 may be used
                           
                             for this purpose).

                           - the procedure may be called with 
                             varying numbers and types of parameters

                           - The first parameter specifies the 
                             system procedure; and must therefore
                           be 
                             a constant expression.…86…1            
                            …02…         …02…  …02…                  …02…     …02…  
                                        
                                                  2975A/ktd  

                                                  15:1:6   BI/821102

           SWELL Compiler & Ex. 1                 L    





SWELL                   The SWELL compiler consists of three main
                        passes and a service pass. 
                        All passes are executed in the same program
                        and data areas, using an overlay technique.
                        The compiler might be characterized as a
                        single pass compiler for a virtual CR80 (executing
                        pseudo instructions, using logical references),
                        followed by a two pass code generator.
                        The main duties of each individual pass are:

Pass 1                  Lexical  analysis
                        Syntax   analysis
                        Name     analysis
                        Semantic analysis

Pass 2                  Preliminary code selection
                        Worst case address allocation
                        Error reporting

Pass 3                  Final code selection
                        Code optimizing
                        Final address allocation

Pass 4                  Generation of cross references
                        Generation of debug information

During Pass 1           The program source text is transformed into
                        an intermediate form.
                        The intermediate code includes operators
                        and symbolic operands, leaving it to the
                        subsequent passes to find CR80 instructuions
                        performing the operations on operands of
                        the specified kinds (registers, constants
                        etc.).
                        All declarations are totally consumed by
                        pass 1 and all structures are broken down
                        into simple context free pseudo instructions.

Pass 2 and 3            Thus, pass 2 and pass 3 are not specifically
                        SWELL oriented, and they may very well be
                        used as code generators for future compilers
                        for the CR80 computer. It should be mentioned,
                        that the compiler produces link modules,
                        and the final code assembly is performed
                        by a linkage editor.

Exercise 1    HO 1



                                                  2975A/ktd  

                                                  15:2:5   BI/821102

           EXPRESSION                             L    





Expressions   OH 1      Constant expressions and variable expressions
              OH 2      'J+H' is not allowed.

Constant                A constant expression is an expression, for  Expressions  which
                                                                                  for
                                                                                  values
                                                                                  of
                                                                                  all
                                                                                  operands
                                                                                  are
                                                                                  constants,
                                                                                  and
                                                                                  where
                                                                                  the
                                                                                  expression
                                                                                  therefore
                                                                                  may
                                                                                  be
                                                                                  evaluated
                                                                                  at
                                                                                  compile
                                                                                  time.
                                                                                  As
                                                                                  for
                                                                                  the
                                                                                  variable
                                                                                  expressions
                                                                                  the
                                                                                  arithmetic
                                                                                  operators
                                                                                  have
                                                                                  the
                                                                                  same
                                                                                  precedence,
                                                                                  and
                                                                                  they
                                                                                  are
                                                                                  executed
                                                                                  from
                                                                                  left
                                                                                  to
                                                                                  right.

Address                 Denotes that the address of an operand is
                        to be used as operand.
                        The address is a word address, and it is
                        not possible to take the address of a variable
                        with base type BYTE.

Location                Denotes that the location of a procedure
                        or a label is to be used as operand.

Size                    Denotes the size of a variable of the specified
                        type.
                        The size of a variable is defined to be the
                        smallest number of words necessary to hold
                        the variable.

Min/Max                 Denotes that the minimum/maximum value of
                        the values defined in the list is to be used
                        as an operand. When the list element is a
                        constant, its value is used.
                        When the list element is a subrange type
                        identifier, the lower/upper bound is used.
                        When the list element is an enumeration type
                        identifier, the value of the first/last enumeration
                        type element is used.

Examples                15
                        'a'
                        -19
                        SIZE (LONG)
                        MAX (SIZE (T1), SIZE (T2), SIZE (T3))
                        ADDRESS ('SWELL')
                        A + B + (C+D)

                        A constant expression is associated a base
                        type corresponding to the concept defined
                        for variables. 
                        T̲h̲e̲ ̲b̲a̲s̲e̲ ̲t̲y̲p̲e̲ ̲o̲f̲ ̲a̲ ̲c̲o̲n̲s̲t̲a̲n̲t̲ ̲i̲s̲ ̲i̲n̲t̲e̲g̲e̲r̲.


                                                  2975A/ktd  

                                                  15:2:5   BI/821102

           EXPRESSION                             L    





Variable      OH 3      Variable expressions are constructs denoting
Expressions             rules for obtaining values or addresses of
                        variables and generating new values by application
                        of operators.

                        In most arithmetic and logic instructions
                        CR80 uses one of the source operands as destination
                        operand. As SWELL supplies no runtime system
                        to support the execution of the program,
                        and as the language reflects the instruction
                        set of CR80, the following rules concerning
                        evaluation of expressions has been defined:

                           * Operators are applied strictly from
                           
                             left to right.

                           * Intermediate results are not stored
                           in 
                             work locations. Instead one of the 
                             source operands is used as destination
                           
                             and thus changed.

                           * If more than one operator have to be
                           
                             applied, the destination operand of
                           an 
                             operation is used as source operand
                           in 
                             the next operation.

Relational    OH 4      A relational expression is a rule for 
Expressions             combining a series of relations. Each relation
                        indicates a test (comparison) giving the
                        result true or false, and the result of a
                        relational expression is true or false.
                        However, the result is not explicitly accessible
                        (cannot be used as an operand). It may only
                        be used as a controlling condition within
                        a statement (conditional or repetitive statement).



                                                  2975A/ktd  

                                                  15:2:6   BI/821102

           STATEMENTS                             L    





Statements    OH 1      Statements denote algorithmic actions, and
                        are said to be executable.

                        A label may be defined by prefixing a statement
                        by the label. A label must be declared and
                        defined in the same block.

                        A label may be referenced from the procedure
                        in which it is declared, and in all inner
                        procedures.

Simple        OH 2      A simple statement is a statement of which
                        
statements              no part constitutes another statement. The
                        empty statement consists of no symbols and
                        denotes no action.

GOTO          OH 3      A goto statement serves to indicate that
                        
statements              processing should continue at a continuation
                        point, defined by a label.

Structured    OH 4      Structured Statements are constructs 
Statements              composed of other statements, which have
                        to be executed either in sequence (compound
                        statement), conditionally (conditional statements),
                        or repeatedly (repetitive statements).

Compound      OH 5      The compound statement specifies that its
                        
Statements              component statements are to be executed in
                        the same sequence as they are written. The
                        symbols 'BEGIN' and 'END' act as statement
                        brackets.

Conditional   OH 6      A conditional statement selects for 
Statements              execution a single one of its component statements.

                        IF
                        CASE
                        SWITCH

If Statements OH 7      The if statement specifies that a statement
                        is to be executed only if a certain condition
                        (relational expression) is true. If it is
                        false, then either no statement is to be
                        executed, or the statement following the
                        symbol 'else' is to be executed.



                                                  2975A/ktd  

                                                  15:2:6   BI/821102

           STATEMENTS                             L    





Case          OH 8      The case statement consists of an expression
                        
Statements              (the selector) and a list of statements,
                        each being labelled by a constant or a constant
                        identifier. It specifies that the one statement
                        is to be executed, whose label is equal to
                        the value of the selector.

                        If the case selector is of subrange type,
                        the case jump table includes one entry for
                        each value in the subrange, and no limit
                        checking is performed. Otherwise the case
                        jump table will include one entry for each
                        value in the range defined by the largest
                        and the smallest occurring case labels, and
                        index checking is performed.

Repetitive    OH 9      Repetitive statements specify that certain
                        
Statements              statements are to be executed repeatedly.

While         OH 10     The while statement specifies that a 
Statements              statement is to be executed repeatedly until
                        a condition (a relational expression) becomes
                        false. If the condition is not true at the
                        beginning, the statement is not executed
                        at all.

Repeat        OH 11     The repeat statement specifies that a number
                        
Statement               of statements are to be executed repeatedly
                        until a condition (relational expression)
                        becomes true. The statements will be executed
                        at least once.



                                                  2975A/ktd  

                                                  15:3:2   BI/821102

           SWITCH MON                             L    





Switch        OH 1      The switch statement is very much like a
                        
Statement               case statement. However, the selector of
                        a switch statement is a switch call (a call
                        of a procedure with multiple exits). 
                        The switch statement specifies that the one
                        statement is to be executed whose label is
                        equal to the exit number through which the
                        procedre terminates.

                        The type identifier used in switch call indicates,
                        via the type associated to it, a range of
                        exit numbers.
                        This facility is mainly used in connection
                        with standard procedures (like MON) having
                        different sets of exits depending on actual
                        parameters.

Exercise 2    HO



                                                  2975A/ktd  

                                                  15:3:6   BI/821102

           VARIABLE INIT                          L    





Variable      OH 1      A variable initialization is a compile time
                        assignment of values to variables.
                        Values must not be assigned to imported variables.
                        Temporary variables are not assignable at
                        compile time.
                        Variables are n̲o̲t̲ initialized a runtime (e.g.
                        at procedure entry).

                        In the initialization part values may be
                        assigned to variables of simple types (integer
                        or char) and to arrays having components
                        of simple type.

Examples                INIT
                           COUNTER=0;
                           CLASSTABLE  0..127  = IGNORE;
                           CLASSTABLE  'A'..'Z'  = ALFA;
                           DAYS ̲PER ̲MONTH= 31, 28, 31, 30, 31, 30,
                           31, 30, 31, 30, 31;

How to        HO
Multiply/
Divide

Exercise 3    HO



                                                  2975A/ktd  

                                                  15:4:4   BI/821102

           PROCEDURES                             L    





Procedure     OH 1      A procedure statement serves to execute the
                        
Statements              procedure denoted by the procedure identifier.
                        The procedure statement contains a list of
                        actual parameters, which must correspond
                        to the formal parameters defined in the procedure
                        declaration (Chapter 13). The correspondance
                        is established by the positions of the parameters
                        in the lists of actual and formal parameters
                        respectively.

                        The exit type of the procedure may be overruled
                        by specifying the type in the procedure call,
                        but the exit type should always include the
                        exit numbers actually used in the procedure
                        body.

Procedure     OH 2      Procedure declarations serve to define parts
                        
Declarations  OH 3      of programs and to associate indentifiers
                        with them, so that they can be activated
                        by procedure statements.

                        The procedure heading specifies the identifier
                        naming the procedure and the formal parameters.

                        Four kinds of parameters exist:

                           - constant parameters

                           - link register

                           - exit parameters

                           - register parameters

Exit          OH 4      An exit statement serves to indicate that
                        
Statements              processing should terminate within the actual
                        procedure and continue at a continuation
                        point in the calling body. 
                        The continuation point is explicitly defined
                        via an expression (of which a register is
                        a simple case) defining the link and optionally
                        an exit number (within the exit range, defined
                        at procedure declaration).
                        If no exit number is specified, this is equivalent
                        to exit no zero.



                                                  2975A/ktd  

                                                  15:4:4   BI/821102

           PROCEDURES                             L    





                        No implicit exit statement is generated (e.g.
                        at the terminating end of a procedure), so
                        it is the programmers responsibility that
                        a procedure is left properly.

Examples                EXIT (R4)                 'return to link'
                        EXIT (R4, SW-ERROR);      'return to error
                        
                                                   exit'
                        EXIT (R4 + SIZE (PROC));  'return after 
                                                   constant
                                                   parameters'

Constant      OH 5      An element denoted by this construction is
                        
Parameter               the UNASSIGNABLE record corresponding to
                        the 
Record                  constant parameters in the actual call of
                        the procedure.
                        The constant parameters are accessed by specifying
                        the formal parameters as fields within this
                        record.

Examples                Denotation of constant
                        parameter record           : R6  COPY
                        
                        Denotation of a constant
                        parameter                  : R6  COPY.FROM

ENTER         OH 6      An enter statement serves to indicate that
statements              processing should continue at a continuation
                        point defined by an expression. The return
                        point may be saved by defining a link register.

Example                 ENTER (R7, R4); "active a program
                                        "part addressed by R7



                                                  2975A/ktd  

                                                  15:5:1   BI/821102

           Dedicated Statement                    L    





Dedicated     OH 1      Is a statement dedicated for the
statements    OH 2      execution of one specific CR80 machine
              OH 3      instruction.

                        May be used to gain address to special features
                        of the CR80 Hardware, e.g. a control operation
                        on an external device.

                        The syntax is very similar to the procedure
                        statement, except for the missing link register
                        (because they do not perform any "jump to
                        subroutine" but merely executes inline code.

Use of        HO
dedicated
Statements

Exercise 5    HO