         Edinburgh IMP77 Compiler - Version 8.4

    1  %systemintegerfn stoi(%string(255) S)
    2  %integer i,k
    3  %integer sign=0, val=0
    4    i = 0
    5    %while i < length(s) %cycle
    6      i = i+1;  k = charno(s,i)
    7      %continue %if k <= ' '
    8      %if k = '-' %start
    9        sign = 1
   10      %else %if '0' <= k <= '9'
   11        val = val<<3+val+val+k-'0'
   12      %else
   13        %signal 4, 1, k{, "Non-numeric character"
   14      %finish
   15    %repeat
   16    %result = val %if sign = 0
   17    %result = -val
   18  %end
   19  
   20  %endoffile

   20 Statements compiled
