[comp.archives] [comp.lang.c...] Good Pascal to C translator available at Caltech

hemphill@cit-vax.Caltech.Edu (Scott Hemphill) (02/10/90)

Archive-name: p2c/08-Feb-90
Original-posting-by: hemphill@cit-vax.Caltech.Edu (Scott Hemphill)
Original-subject: Re: Pascal to C Conversion
Archive-site: csvax.caltech.edu [192.12.18.1]
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)

In article <4007@cbnewsl.ATT.COM> feg@clyde.ATT.COM writes:
>
>Although any of the these Pascal-C translators can handle 
>most of the job, none of them can unravel Pascal's nested
>functions.  The translators leave that task to humans.

This is not true.  Here at Caltech, Dave Gillespie has written a truly
wonderful Pascal to C translator.  It is called p2c, and is available via
anonymous ftp from csvax.caltech.edu.  It is also in the queue to be posted
to comp.sources.unix.

It translates the following Pascal dialects:

  o  HP Pascal
  o  Turbo/UCSD Pascal
  o  VAX Pascal
  o  Oregon Software Pascal/2
  o  Macintosh Programmer's Workshop Pascal

It also supports Modula-2 syntax.  Output C code can be machine-independent,
or can be targeted for a specific machine and compiler.  It produces well-
formatted (you can configure it for your own indentation style) human readable
and maintainable C, using C idioms when possible.  Every program I have
translated has required no human intervention at all.  It even passes a large
part of a Pascal validation test suite.
-- 
Scott Hemphill	hemphill@csvax.caltech.edu	...!ames!elroy!cit-vax!hemphill