$Id: Read_me,v 2.2 1997/09/20 17:17:37 nestor Exp $
$Locker:  $
$Log: Read_me,v $
Revision 2.2  1997/09/20 17:17:37  nestor
Correct two problems with comments: remove the original comment
delimiters in Ada comments, admit odd number of stars between
delimiters in comments of this kind (*****).

 Revision 2.1  1997/08/23  16:50:31  nestor
 Laurent Gasser's correction for MacOS extended Pascal


   PPP    22    AA   DDD    AA
   P  P  2  2  A  A  D  D  A  A
   PPP     2   AAAA  D  D  AAAA
   P      2    A  A  D  D  A  A
   P     2222  A  A  DDD   A  A

Partially Convert Extended MacOS Pascal to Ada 95

The utility p2ada reads from the standard input a Pascal source file and 
convert it into an Ada 95 source file on the standard output.  The conversion
is not complete, and the resulting Ada 95 source file may have to be corrected
manually by the programmer (see KNOWN LIMITATIONS).  It is purely syntactic.

PORTING TO MACHTEN

This utility is mainly the product of aflex (Pascal.l) and ayacc (Pascal.y).
The package p2ada has been tested under GNAT 3.07 on MachTen CodeBuilder 1.0.
The changes necessary to create the sources files adapted to GNAT have been
documented in an automatic genaration (Makefile). It fully automatizes a
rebuild after changes to the regular expressions or grammar definitions. Call 

 make help

to see what targets are available.  One change is specific to the way 
the tool aflex has been ported to Ada 95.  If it still assumes an Ada 83
character set, the constant definition of yy_ec has to be extended by 
"others => 1".  This crude extension is effective in the Makefile.

Ayacc processes the rules file Pascal.y with the following message:

 375 Productions
 240 Nonterminals
 80 Terminals
 544 States
 4 Shift/Reduce conflicts
 0 Reduce/Reduce conflicts

To compile the utility p2da, use the command

 gnatmake p2ada

which builds the utility from existing source files.  The compilation
produces the following warning

 gcc -c pascal_io.adb
 pascal_io.adb:7:05: warning: "c" is never assigned a value

which can be ignored safely (the variable is never used).  Another option
is to build the utility p2ada starting from the regular expressions and 
grammar definitions:

 make all

KNOW LIMITATIONS

- The resulting Ada sources are not always legal.  Illegalities come from
    * anonymous types: in many cases, new types has to be defined.
    * dependency statement (USES in Pascal): the Ada WITH statement should
      be outside of the heading, and all packages are implicitely USEd.
    * variant records: no identifier is given for the discriminant of
      the variant.  The case opening the variant lists the type of the 
      discriminant instead of the discriminant identifier.
    * procedures or functions as access type: in Pascal, the type is defined 
      in two steps (a name for the header, a name for the access).  In Ada,
      merge the two.
    * "ellipse" statements: the Pascal WITH statement is partially translated
      in a DECLARE ... RENAME ... BEGIN ... END; block in Ada.  Explicit
      record association has to be provided manually.
    * some empty statements are not converted to  NULL; .
    * sets are not handled at all.

- The Ada dependency clauses (WITH) should preceed the routine or package
  header.  The programmer has to decide which dependency will be USEd.

- The WITH block of Pascal is not treated satisfactoringly.  The comment
  -- HELP!! WITH
  signalizes places where the programmer has to modify the code and an
  uncomplete solution is proposed.

- Comments cannot be more than 1024 characters long.  This is adjustable in
  pascal_dfa.YYText  by the length of buffer.  Or you can split your comments
  by adding  }{  or  *) (*  pairs.

- Pointer dereference is not optimal.  With the declarations

  TYPE
    Point = record x, y : real end;
    Point_Ptr = ^Point;
  VAR 
    to_P : Point_Ptr;

  the Pascal statement  to_P^.x  is converted to  to_P.all.x  instead of the 
  better  to_P.x  encoding.

- Some empty statement are not translated to  NULL; .  This is especially 
  visible in case statements with empty default alternate.

- The resulting layout is, to say the least, uncommon... 

AUTHORS

The author of the original version is
   Martin C. Carlisle, US Air Force Academy
   November 26, 1996
   carlislem@acm.org
   http://www.usafa.af.mil/dfcs/bios/carlisle.html

The extension to MacOS and the introduction of bugs is due to
   Laurent Gasser, Hirondelle Lumineuse
   June 22, 1997
   Zurich, Switzerland
   lga@sma.ch

COPYRIGHTS

This is public domain. No warranty of any kind.
