         Edinburgh IMP77 Compiler - Version 8.4

    1  %begin
    2    %routine level2 test array(%string(255) who, %integerarrayname harry, %integer from low, to high)
    3      %integer element
    4      %for element = from low, 1, to high %cycle
    5        print string("Child of "); print string(who); printsymbol('('); write(element, 0); printstring(") = ");
    6        write(harry(element), 0); newline
    7      %repeat
    8    %end
    9  
   10    %routine test array(%string(255) who, %integerarrayname harry, %integer from low, to high)
   11      %integer element
   12      %for element = from low, 1, to high %cycle
   13        print string(who); printsymbol('('); write(element, 0); printstring(") = ");
   14        write(harry(element), 0); newline
   15      %repeat
   16      level2 test array(who, harry, from low, to high);
   17    %end
   18  
   19    %ownintegerarray bert(-3:6);  ! note non-0 lower bound static array
   20    %integer i
   21  
   22    %for i = -3, 1, 6 %cycle
   23      bert(i) = i * 10
   24    %repeat
   25  
   26    ! i2c passes &bert[0] but should have passed &(bert - (-3))[0]
   27    !  or equivalent, to account for the non-0 lower bound!
   28    test array("bert", bert, -3, 6);       ! static bounds arrays now fixed, but ...
   29  
   30    %ownintegerarrayname pointer
   31  
   32    pointer == bert
   33  
   34    test array("pointer to bert", pointer, -3, 6);       ! static bounds arrays now fixed, but ...
   35  
   36    %begin
   37      %integerarray sheila(-3:6);  ! note non-0 lower bound *AUTO* array
   38  
   39      %for i = -3, 1, 6 %cycle
?Non-local
   40        sheila(i) = i * 10
   41      %repeat
   42  
   43      ! i2c passes &bert[0] but should have passed &(bert - (-3))[0]
   44      !  or equivalent, to account for the non-0 lower bound!
   45      test array("sheila", sheila, -3, 6);   ! ... but dynamic bounds (auto) arrays not yet implemented... 
   46    %end
   47  
   48  %endofprogram

   42 Statements compiled
