[comp.lang.misc] Pascal to C Conversion

phipps@garth.UUCP (Clay Phipps) (02/06/90)

We are also looking for an automatic Pascal-to-C source-code converter.

There are rumors of one being available at U.C. Berkeley.
If accurate, would someone please be a little more specific ?

A posting a few months ago made a reference to one on "the UUCP tape",
but that is apparently not a universally recognized designation for
that tape (communications is not my subfield), if it exists at all.

In article <52037@XAIT.Xerox.COM>,
rmeyer@XAIT.Xerox.COM (Richard Meyer) wrote:
>
>In your reply, please indicate the source for the converter, 
>price (if applicable), 
>any positive / negative experience you may have, 
>and language flavors supported.

I don't recall seeing anything about it in this news-group in the year 
or so that I've been back on the net (after an absence of 3 years).
Rather than replying privately to Meyer at Xerox, I encourage those
with answers to please go ahead and post the information.

Thanks for any help that you may be able to offer.
-- 
[The foregoing may or may not represent the position, if any, of my employer, ]
[ who is identified solely to allow the reader to account for personal biases.]
                                              
Clay Phipps 
Intergraph APD: 2400#4 Geng Road, Palo Alto, CA 94303; 415/852-2327
UseNet (Intergraph internal): ingr!apd!phipps
UseNet (external): {apple,pyramid,sri-unix}!garth!phipps        EcoNet: cphipps

gupta@cad.Berkeley.EDU (Rajesh Gupta) (02/06/90)

In article <3576@garth.UUCP> phipps@garth.UUCP writes:
>We are also looking for an automatic Pascal-to-C source-code converter.
>
>There are rumors of one being available at U.C. Berkeley.
>If accurate, would someone please be a little more specific ?
...
>In article <52037@XAIT.Xerox.COM>,
>rmeyer@XAIT.Xerox.COM (Richard Meyer) wrote:
>>
>>In your reply, please indicate the source for the converter, 
>>price (if applicable), 
>>any positive / negative experience you may have, 
>>and language flavors supported.
>
>I don't recall seeing anything about it in this news-group in the year 
>or so that I've been back on the net (after an absence of 3 years).
>Rather than replying privately to Meyer at Xerox, I encourage those
>with answers to please go ahead and post the information.
>

I have a pascal-to-c converter that sort of works. Though I have never
extensively used it.  If there is sufficient interest I can 
mail a copy on the net or mail it individually.

Rajesh Gupta
--
CSL
rgupta@sirius.stanford.edu

======================================================
gupta@cad.berkeley.edu.ARPA
gupta@esvax.berkeley.edu.ARPA
..ucbvax!ucbcad!gupta@berkeley.edu.ARPA

streich@boulder.Colorado.EDU (Mark Streich) (02/06/90)

You can get the source to a Pascal-to-C converter at csvax.caltech.edu that
is called p2c.  It handles a variety of pascals and modula-2 as well.

feg@clyde.ATT.COM (Forrest Gehrke,2C-119,7239,ATTBL) (02/07/90)

In article <3576@garth.UUCP>, phipps@garth.UUCP (Clay Phipps) writes:
> We are also looking for an automatic Pascal-to-C source-code converter.
> >
> >In your reply, please indicate the source for the converter, 
> >price (if applicable), 
> >any positive / negative experience you may have, 
> >and language flavors supported.




You will find a fairly good translator on SIMTEL20 archives
under MSDOS.C directory which was put out by Microsoft
a couple of years ago.  T2C.ARC   152K bytes

Its specially configured to translate TurboPascal to MSC, natch.

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.

Forrest Gehrke feg@clyde.ATT.COM

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

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

gsarff@meph.UUCP (Gary Sarff) (02/09/90)

In article <4007@cbnewsl.ATT.COM>, feg@clyde.ATT.COM (Forrest Gehrke,2C-119,7239,ATTBL) writes:
>In article <3576@garth.UUCP>, phipps@garth.UUCP (Clay Phipps) writes:
>> We are also looking for an automatic Pascal-to-C source-code converter.
>> >
>> >In your reply, please indicate the source for the converter, 
>> >price (if applicable), 
>> >any positive / negative experience you may have, 
>> >and language flavors supported.
>
>You will find a fairly good translator on SIMTEL20 archives
>under MSDOS.C directory which was put out by Microsoft
>a couple of years ago.  T2C.ARC   152K bytes
>
>Its specially configured to translate TurboPascal to MSC, natch.
>
>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.
>

I have one that does do nested procedures and functions.  It came off of
usenet a few years ago (2,3?) in comp.sources.unix I believe.  It is in
Pascal, (there was a C version posted, which was the pascal version run on
itself), and produced pretty bizarre looking code compared to what p2c
produces, but it did do nested procedures, variant records, pascal I/O, etc.