home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d512 / m2pascal.lha / M2Pascal / M2Pascal.doc < prev    next >
Text File  |  1991-07-20  |  6KB  |  162 lines

  1. OVERVIEW:
  2.  
  3.      This program was developed because of the popularity of pascal and
  4.      the lack of a decent pascal compiler for the Amiga. My intent in
  5.      writing this program was to help the college student with his projects
  6.      by enabling him to use his Modula-2 compiler and all of the advantages
  7.      of the language and environment without stepping down to a pascal
  8.      compiler.
  9.  
  10.      In theory this is how it work: write the assignment at home with
  11.      your Amiga and Modula-2 package and then run it through 'm2pascal'--
  12.      presto -- pascal. It's a lot easier then doing it by hand ! Of course
  13.      this program is not limited to college students, but keep in mind that
  14.      it is intended for short, simple programs.
  15.  
  16.      This work is released to the public-domain and may be modified at will, so
  17.      long as it's not sold for profit and my name is keep intact somewhere.
  18.      This is the first real program I ever wrote, so it's not written very 
  19.      well. Scan.mod, for instance, is especially buggy and difficult to 
  20.      understand.
  21.  
  22.      Because of it's public domain nature there is no warranty, implied
  23.      or otherwise. Use at your own risk!
  24.  
  25.  
  26. QUICK AND DIRTY:
  27.  
  28.      Nobody likes reading documentation! Here's how to run this program:
  29.  
  30.  
  31.                    ****************************
  32.                    *                          *
  33.                    *  1> copy test.mod ram:   *
  34.                    *  1> copy m2pascal ram:   *
  35.                    *                          *
  36.                    *  1> m2pascal test.mod    *   +Make sure test.mod compiles
  37.                    *                          *    with no errors under 
  38.                    *                          *    Modula-2.
  39.                    *  1> more test.p          *   +Set stack to 10000.
  40.                    *                          *
  41.                    ****************************           
  42.  
  43. DISCRIPTION:
  44.  
  45.      Commands :
  46.  
  47.                 -bn, -bd     ->   place "begin" on line BELOW statement
  48.                                   example: m2pascal -bd test.mod test.p
  49.                 -?,  -h      ->   help
  50.                                   example: m2pascal -?
  51.  
  52.      Terminal I/O translation
  53.  
  54.           -  Commands beginning with "write" (such as "WriteInt" )  are
  55.              translated as the following example shows: The command
  56.              on the right is modula-2, the left is pascal.
  57.  
  58.                        WriteInt ( number , 1 )   ==>    writeln ( number )
  59.  
  60.           - Commands beginning with "Read" ( ReadString, ReadInt etc... )
  61.             are are translated as the following example show:
  62.  
  63.                        ReadInt ( number )   ==>    read ( number )
  64.  
  65.             note: A pascal readln statement might have to be inserted
  66.             manually after translating with m2pascal.
  67.  
  68.  
  69.           - Special note: The benchmark C slash command "\n" is fully 
  70.             supported. For example:
  71.  
  72.                        WriteString("hi\n")       ==>  write('hi'); writeln;
  73.  
  74.  
  75.  
  76. BUGS/PROBLEMS:  ( hey I SAID it was public domain, did you keep the receipt? )
  77.  
  78.      Outputfile ( object file ) destroyed without query.      ( scan.mod )
  79.  
  80.      Spaces REQUIRED in INC/DEC/ALLOCATE/DEALLOCATE commands: ( StandardIO.mod )
  81.  
  82.                  INC ( i , 1 ) ;      works, but   INC(i,1,);     doesn't 
  83.  
  84.      Tabs treated as one space.                               ( OutModule.mod )
  85.  
  86.          -Tabs don't work correctly in some circumstances. The use of a tab 
  87.           might cause the output "not to be aligned" with the above line OR
  88.           may extend the text beyond the designated line length.
  89.     
  90.         - Running m2detab or a similar tab removable program will solve
  91.           the problem.
  92.  
  93.      Doesn't respond well to single statements seperated onto seperate lines.
  94.  
  95.      Multidemensional arrays not supported. 
  96.  
  97.      CASE statement not supported.                           ( process.mod )
  98.  
  99.          - If you have a CASE statement edit the resulting pascal program
  100.            as follows:
  101.  
  102.                    - Place a 'begin' after all colons.
  103.                    - If the CASE statement has a default ('ELSE...') option
  104.                      then erase the 'end' directly before it or your program
  105.                      will have one too many end's in it.
  106.  
  107.      Do not use the underscore character "_" in variable names if your pascal
  108.      compiler doesn't support it.
  109.  
  110.      Do not use empty parenthesis in the declaration of a procedure:
  111.  
  112.             PROCEDURE flag () : BOOLEAN           PROCEDURE flag : BOOLEAN;
  113.                                            OR
  114.                            wrong                               right
  115.     
  116.      Procedures which contain the keyword 'RETURN' but do not return a value
  117.      will be translated incorrectly.     
  118.  
  119.      Intended for single pass modula-2 compiler ONLY. ( like benchmark )
  120.  
  121.                    - m2pascal will not arrange procedures/functions in your
  122.                      resulting file to work with a single pass pascal compiler.
  123.  
  124.      Intended for use on syntactically correct modula-2 programs. If there
  125.      is an error in your program m2pascal may behave unpredictably.
  126.  
  127.  
  128. EXTENSIONS:
  129.  
  130.      Nested functions. Technically this is illegal in Module-2, but maybe
  131.      the new standard will support it.
  132.  
  133.      Infinitely many nested comments are accepted. ( The resulting pascal
  134.      compiler may not support this. )
  135.  
  136.      The C slash command for a new line ( "\n" ) is understood.
  137.  
  138.      Keyword 'begin' can be put on the line following the command with
  139.      the "-bn" command line option:
  140.  
  141.           if a=1 then begin              if a=1 then
  142.            ...                   OR      begin
  143.            ...                            ...
  144.           end;                           end;
  145.      
  146.  
  147. COMPILATION NOTES NOT USING BENCHMARK:
  148.  
  149.     The only compiler I own is the Benchmark compiler so I have not tried
  150.     compiling it with anything else. The source is as generic as possible. 
  151.     Remember that benchmark allows the underscore char "_" in variable names. 
  152.     Also remember that the C slash commands are also supported in 
  153.     benchmark strings (i.e. "\n" ).
  154.  
  155.  
  156. AUTHOR:
  157.     
  158.     Greg Mumm
  159.  
  160.     7267 W. Cody Circle
  161.     Milwaukee, WI 53223
  162.