$a invert=0; cap=0; capsh=0; und=0; undsh=0 $a line=80; page=0; top=0; bottom=0 $b8 $l A P M I M P P R O G R A M M E R ' S G U I D E $b6 This manual describes the implementation of the IMP programming language for the APM and includes a description of the main library modules which are available to the programmer. $n $l1u Definition of Language $p The IMP language as implemented on the APM is the agreed version for forward development on the VAX/VMS and M68000 systems. It is substantially as defined in the EUCSD Report "The IMP77 Language" (3rd Edition), with the following exceptions. $a tab=6,10; indent=2 $b2 $l1 Discarded features: $l0 $i- .$t+ non-decimal constants expressed in IBM style (X'...') $i- .$t+ %name %function as alternative to %map $i- .$t+ loops with a control clause after as well as before (ie an %until as well as a %while or %for) $b2 $l1 Modified features: $b $i- .$t+ the declaration of %arrayname parameters requires the specification of bounds either as literals or as declared local variables, as illustrated in the following examples: $l0i %integerarrayname a(1:1000) %realarrayname delta(10:20,1:30) %bytearrayname used(1:%integer xdim,1:%integer ydim) %shortarrayname count(%byte lo:%byte hi) $b0 in order to match the formal parameter, an actual array must have been declared with at least as many dimensions and with identical literals where the formal has literals. $b2 $l1 Added features $i- .$t+ there are a number of additions which make it possible to exercise greater control over the way in which variables are allocated and parameters are passed; these are not of general utility and are not described here. $b2 $l1 Variant implementation $l0 $i- .$t+ the effect of %continue is to pass control to the head of the containing loop, where any %while or %for control clause is tested; any %until clause at the end of the loop is ignored. $n $l1u Implementation restrictions $p The range of integers handled is the 32-bit signed twos-complement range. Apart from type-checking, the declaration %longinteger is treated as equivalent to %integer. $b0 Both signed and unsigned (%short and %half) 16-bit integers are supported, the former slightly more efficiently. $b0 Both signed and unsigned (%mite and %byte) 8-bit integers are supported, the former slightly more efficiently. $p In the present implementation, floating-point numbers are limited to 32-bits and the operations on them are implemented by software. Apart from type-checking, the declaration %longreal has the same effect as %real $p The maximum number of nested textual levels permitted is eight. In this respect, no distinction is made between procedures and %begin/%end blocks. $p The maximum number of nested conditionals or loops is fifteen. $p A strict rule of ordering between the declarations and instructions in a block is not imposed, but the following restrictions apply: $l0 No declarations are permitted within conditionals or loops; Only static declarations (%const, %own, %external and procedures) are permitted to follow instructions which include a forward jump or procedure call; The specifications for %external procedures and data objects must appear in the outermost level or main %begin/%end block. $b Features of IMP77 which are not valid in IMP80 (EMAS IMP) and conversely, or which are peculiar to this implementation, are reported as 'non-standard' (warning only). However, this warning is not produced for the following widely used IMP77 facilities, even though they are not available in IMP80: $l0 %shortintegers, %predicates, %else %if, operator mod-sign, initialisation of dynamic variables to literal values (but initialisation to non-literal values is flagged). $b $l1 ! ! produce listing to specified file (extension LIS) -LIST produce listing to file with same name as source and extension LIS -LIST produce listing to network printer -NOLIST do not produce listing -LOG output statistics indicating number of statements, atoms per statement, identifiers per statement, time taken, etc. Default: -NOLIST-NOLOG Object program control: -OBJ produce object file with same name as source and extension MOB -OBJ= produce object file with specified name (default extension MOB) -NOOBJ do not produce object file Default: -OBJ (but only if no errors reported) Run-time checks: ? -ASS include unassigned check on full integers ? -STRASS include unassigned check on strings ? -SASS include unassigned check on shorts ? -BASS include unassigned check on bytes ? -ARR include array bound checking * -LOOP include %for loop check * -OVER include overflow check * -CAP include capacity checking Default: -ASS-STRASS-NOSASS-NOBASS-ARR-LOOP-OVER-CAP -NOCHECK has the effect of suppressing all checks Run-time diagnostics: -DIAG include line-number updating for diagnostics -TRACE generate code which allows the program to be executed one line at a time under the control of the Software Front Panel Default: -NODIAG-NOTRACE $l2 !> ! !> ! !> ! !> ! !