Pascal to C Conversion

Scott Hemphill hemphill at cit-vax.Caltech.Edu
Fri Feb 9 03:33:48 AEST 1990


In article <4007 at cbnewsl.ATT.COM> feg at 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 at csvax.caltech.edu	...!ames!elroy!cit-vax!hemphill



More information about the Comp.lang.c mailing list