Date: Tuesday, 14-Jan-97 23:22:42 GMT Server: NCSA/1.3 MIME-version: 1.0 Content-type: text/html Jerzy W. Jaromczyk -- Compilers

Compilers - Semantic Analysis - November 19, 1996 - Lab



program testlevels;

{ the purpose of this program is to test if we can get too many levels  }


var x,y,z:integer;
var a:  array [1..100] of integer;

procedure one;

begin
   for i := 1 to 100 do
      a[i] := 0;
end;

procedure two;

begin
   for i := 1 to z do
      a[i] := 7;
end;

procedure three;

begin
   for i := z to 100 do
      a[i] := somenumber;
end;

procedure four;

begin
   for i := x to z do
      a[i] := abignumber;
end;

procedure five;

begin
   for i := 100 downto x  do
      begin
         a[i] := 3;
         y := a[i] * z;
         z := z + 1;
      end;
end;

{ we should get a nesting error in this mess}

procedure stacklevels;
   procedure stack2;
      procedure stack3;
         procedure stack4;
            procedure stack5;
               procedure stack6;
                  procedure stack7;
                     procedure stack8;
                        procedure stack9;
                           procedure stack10;
                              procedure stack11;
                                 begin
                                    x := 3 * x;
                                 end;
                              begin
                                 x := 3 * x;
                              end;
                           begin 
                              x := 3 * x;
                           end;
                        begin 
                           x := 3 * x;
                        end;
                     begin
                        x := 3 * x;
                     end;
                  begin 
                     x := 3 * x;
                  end;
               begin 
                  x := 3 * x;
               end;
            begin
               x := 3 * x;
            end;
         begin 
            x := 3 * x;
         end;
      begin 
         x := 3 * x;
      end;
   begin 
      x := 3 * x;
   end;
begin 
   x := 3 * x;
end;
   


begin
   one;
   two;
   three;
   four ;
   five;
end.