home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / mod2tutr.zip / EXAMPLES.ZIP / CH07E1.MOD < prev    next >
Text File  |  1989-01-18  |  1KB  |  57 lines

  1.                             (* Chapter 7 - Programming exercise 1 *)
  2.                                          (* Chapter 7 - Program 1 *)
  3. MODULE CH07E1;            (* Overall program construction example *)
  4.  
  5. FROM InOut IMPORT WriteString, WriteLn;
  6.  
  7.      PROCEDURE Proc1;
  8.      BEGIN
  9.        WriteString("Procedure 1");
  10.        WriteLn;
  11.        Proc3;        (* Illegal call *)
  12.        Proc5;        (* Illegal call *)
  13.      END Proc1;
  14.  
  15.      PROCEDURE Proc2;
  16.           PROCEDURE Proc3;
  17.           BEGIN
  18.             WriteString("Procedure 3");
  19.             WriteLn;
  20.           END Proc3;
  21.  
  22.           PROCEDURE Proc4;
  23.                PROCEDURE Proc5;
  24.                BEGIN
  25.                  WriteString("Procedure 5");
  26.                  WriteLn;
  27.                END Proc5;
  28.           BEGIN
  29.             WriteString("Procedure 4");
  30.             WriteLn;
  31.             Proc5;
  32.             Proc3;
  33.           END Proc4;
  34.      BEGIN
  35.        WriteString("Procedure 2");
  36.        WriteLn;
  37.        Proc3;
  38.        Proc4;
  39.      END Proc2;
  40.  
  41. BEGIN
  42.   WriteString("Main Program");
  43.   WriteLn;
  44.   Proc2;
  45.   Proc1;
  46. END CH07E1.
  47.  
  48.  
  49.  
  50.  
  51. (* Result of execution
  52.  
  53. (Compile errors, will not compile or execute.)
  54.  
  55. *)
  56.  
  57.