[comp.lang.c] C to Pascal Conversion

hpoppe@bierstadt.scd.ucar.edu (Herb Poppe) (02/09/90)

How about the flip side of the coin? Does anyone know of C to Pascal
translators?

--
Herb Poppe      NCAR                         INTERNET: hpoppe@ncar.ucar.edu
(303) 497-1296  P.O. Box 3000                   CSNET: hpoppe@ncar.CSNET
		Boulder, CO  80307               UUCP: hpoppe@ncar.UUCP

henry@utzoo.uucp (Henry Spencer) (02/11/90)

In article <6263@ncar.ucar.edu> hpoppe@bierstadt.scd.ucar.edu (Herb Poppe) writes:
>How about the flip side of the coin? Does anyone know of C to Pascal
>translators?

I'd be very surprised to hear of any, since most C programs cannot be
translated into Pascal in any simple way.  C's pointers, in particular,
are far more powerful than Pascal's and there is no easy way to fake them.
-- 
SVR4:  every feature you ever |     Henry Spencer at U of Toronto Zoology
wanted, and plenty you didn't.| uunet!attcan!utzoo!henry henry@zoo.toronto.edu

woody@rpp386.cactus.org (Woodrow Baker) (02/11/90)

In article <6263@ncar.ucar.edu>, hpoppe@bierstadt.scd.ucar.edu (Herb Poppe) writes:
> How about the flip side of the coin? Does anyone know of C to Pascal
> translators?

SHUDDER!!!! I HOPE NOT!, jumping willies!  Would you put a lawnmower engine
in a Porche ??

PASCAL is somthing that got loose from the lab.  YIKKES, bring out the 
dog catchers.

Seriously, if you have a need for it, I think that there may be one out in
PC land.  Check some local bbs's.  I seem to remember that one does exists
somewhere out there.


m
> 
Cheers
Woody

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (02/12/90)

In article <1990Feb10.231432.27149@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>In article <6263@ncar.ucar.edu> hpoppe@bierstadt.scd.ucar.edu (Herb Poppe) writes:
>>How about the flip side of the coin? Does anyone know of C to Pascal
>>translators?
>
>I'd be very surprised to hear of any, since most C programs cannot be
>translated into Pascal in any simple way.  C's pointers, in particular,
>are far more powerful than Pascal's and there is no easy way to fake them.

Do you think so?  Perhaps you're talking about standard Pascal; Turbo Pascal
lets pointers be used almost as loosely as C does.  Certainly there's no
built in operator to increment one, but it would be very easy to write one:
 inc(longint(rec_ptr),sizeof(rec));
would come close if you didn't need to worry about crossing segment boundaries.

A bigger problem would be the growth in a program if it were translated.  
Assignments must all be done in separate statements in Pascal (unless you
define an assignment function), and Turbo Pascal doesn't support macros
the way C does, so they'd all have to be expanded before translation.

Of course, the biggest problem of all would be that the Pascal program would
end up just as unreadable as the C program it was translated from - even
Pascal can't make an ugly program pretty.

Duncan Murdoch