[comp.compilers] Announcing a Pascal to C translator

daveg@near.cs.caltech.edu (Dave Gillespie) (11/11/89)

I have seen several inquiries here about Pascal to C translators.  I have
been working on such a program on and off for the past year.  It is now
at the point that it can translate most Pascal programs into fully
functional, readable C.  I have archived it on the anonymous FTP account
of hobiecat.cs.caltech.edu (131.215.131.167) for your enjoyment.

Specifications and Fanfare:  The program, called "p2c", reads and translates
the full dialects of HP Standard Pascal and Turbo Pascal 5.0, and most of
Oregon Software Pascal/2.  It translates code using variant records, nested
procedures, modules, strings, and yes, even full sets into C code which in
most cases is of human-written quality.  Output code is normally machine-
and system-independent but can be targeted to particular architectures (such
as those with 32-bit ints) if desired.  Output can be original C, traditional
Unix C, or Ansi C.  Custom translations can be defined for selected functions
and variables in the program or library.  Pascal comments are carried over
into C, with additional comments inserted to note places that may require
human touch-up.

To quote the BUGS section of the manual:
   P2c was designed with the idea that clean, readable output
   in most cases is worth more than guaranteed correct output
   in extreme cases.  P2c is not a compiler!  However, ideally
   the "extreme" cases would include only those which never arise
   in real life.  Thus if p2c actually generates incorrect code
   I will consider it a bug, but I will not apologize for it. :-)

Bug reports and suggestions are welcome, but I can not guarantee I will
have time to work on them.  If you do not have access to FTP, send me
e-mail and we'll work something out.
--
Dave Gillespie
  256-80 Caltech Pasadena CA USA 91125
  daveg@csvax.caltech.edu, cit-vax!daveg
-- 
Send compilers articles to compilers@esegue.segue.boston.ma.us
{spdcc | ima | lotus}!esegue.  Meta-mail to compilers-request@esegue.
Please send responses to the author of the message, not the poster.