[comp.lang.pascal] There is a pas2c. Is there a c2pas?

slavitch@spock (Michael Slavitch) (11/24/89)

Hi,
         For those on comp.unix.questions, this is not a unix question, but rather a unix _tool_ question. 

	I've had a chance to browse through the uunet tape at our site and I 
noticed that an ANSI Pascal -> c converter is available on it. Unfortunately, 
there is no c -> ANSI Pascal converter on that tape. Would there be someone,
somewhere in netville that would have access to such? It would make life here
a lot easier. Hand-translating state tables from c to Pascal is akin to the 
sound of fingernails scratching on a chalkboard. 

	If it sounds like I'm begging. It's only because I am.

	Please E-mail a response to me, rather than posting. I may not be able 
to monitor all these newsgroups.
  
Michael.


-- 
  (signoff follows)                    
-------------------------------------------------------------------------------
Michael Slavitch --------------------------------->  uunet!mitel!spock!slavitch
-------------------------------------------------------------------------------

antony@lbl-csam.arpa (Antony A. Courtney) (11/25/89)

I highly doubt there is or will ever be a C to Pascal converter.  

Show me pointers to functions in Pascal and maybe I'll start to consider it a
_REAL_ language!  :-)

				antony
--
*******************************************************************************
Antony A. Courtney				antony@lbl.gov
Advanced Development Group			ucbvax!lbl-csam.arpa!antony
Lawrence Berkeley Laboratory			AACourtney@lbl.gov

sakkinen@tukki.jyu.fi (Markku Sakkinen) (11/26/89)

In article <4289@helios.ee.lbl.gov> antony@lbl-csam.arpa (Antony A. Courtney) writes:
>
>I highly doubt there is or will ever be a C to Pascal converter.  

I agree - but not _only_ because of the weakness of Pascal.
The semantics of C is so irregular that I doubt the feasibility
of a converter from C to _any_ high-level language
(I didn't say 'any other' because I classify C as a medium-level language).

>Show me pointers to functions in Pascal and maybe I'll start to consider it a
>_REAL_ language!  :-)

All right: any function appearing as a formal parameter of another function
or procedure is in effect a pointer to a function;
you didn't say it should be a first-class type (or variable). :-)

Markku Sakkinen
Department of Computer Science
University of Jyvaskyla (a's with umlauts)
Seminaarinkatu 15
SF-40100 Jyvaskyla (umlauts again)
Finland

karl@haddock.ima.isc.com (Karl Heuer) (11/27/89)

In article <4289@helios.ee.lbl.gov> antony@lbl-csam.arpa (Antony A. Courtney) writes:
>I highly doubt there is or will ever be a C to Pascal converter.

It's certainly possible, since the two languages are TM-equivalent.

>Show me pointers to functions in Pascal ...

One way to emulate this feature would be to keep track of the functions whose
addresses are taken, and use an integer index instead:
	long (*pf)();   ==>   var pf: 0..MAX_INDEX;
	pf = &f;        ==>   pf := INDEX_CORRESPONDING_TO_F;
	r = (*pf)(i);   ==>   if pf = 0 then r := f(i) else ...
This isn't much worse than the cruft required to get sane string handling.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
(Language-specific followups should go to c.l.c or c.l.pascal as appropriate.
Default followups to c.l.misc.)

randy@m2xenix.UUCP (Randy Bush) (11/29/89)

Knowledge Software (Derek Jones) in the UK did one for MS-DROSS, but not if or
how well it works.  Executable, not source, is available from the FidoNet
syatem at +1(503)297-9145, aka 1:105/6, as KSW-CTOP.LZH.

-- 
uunet!{ tektronix!nosun!qiclab, oresoft, intelhf }!m2xenix!randy  Randy Bush