[comp.sys.ibm.pc] Pascal To C translator

paige@cg-d.UUCP (Tom Paige X5041) (03/17/87)

Hi, 

     I'm looking for a Turbo Pascal to C translator.  I saw it mentioned on
     the net, but I didn't catch whether one was available or where.  If
     such a beast exists, could someone e-mail me some information, or
     numbers of BBS's where it might be available?

     Thanks.

     Tom Paige
     Compugraphic Corp.
     Wilmington, Ma.
     ...!decvax!cg-d!paige

     ...

asjoshi@phoenix.Princeton.EDU (Amit S. Joshi) (02/08/88)

Hello,

I have some goodnews and some badnews for all those folks who (like me)
wrote in Pascal and now have shifted to C. First the good news:
	I have managed to get the TERRIFIC translator that Per
	Bergen of Holistic Technology AB, Sweden, wrote and put
	onto the net for Unix machines to work with almost no 
	effort for IBMPC's running MSDOS. It is a humungous (spelling?)
	program - the source code is like 250K and there are functions
	in it that only compile on a >640K machine iff (if and only if)
	kept in a seperate files by themselves. The executable is about
	120K (when I used the small model) and 180K under the large
	model. What's so good about it? It actually parses the entire
	Pascal program and then constructs a parse tree , transforms and
	then produces C code based on the parse tree. Result? It has 
	actually translated code and not simply replaced function calls
	by calls to some library. A quick figure: the simple program
		program test(input,output);
		begin
		     writeln('hello');
		end.
	becomes into a big source program. But the executable (using
	Turbo C) is smaller than the Com file by Turbo Pascal v3.0 !!
	(like 5k for test.exe (turboC medium model) and 11k for test.com
	using Turbo Pascal.
Which brings me to the bad news:
	It only recognizes ISO Pascal (I don't mind - I always believed
	in using standard stuff). This means no Turbo Pascal !.
	The other things are no include files (I am writing a filter to
	take care of that). It also has a couple of very subtle bugs
	(features?) in the way it handles std I/O but even these are
	very Pascal features that can't be put into C in a general
	manner and won't affect most people for one and I don't know 
	of any translator that handles them either !
However I think that the translator can be extended (it seems to be
table driven) but I don't think that I am going to do it - it can handle
my code :-).      

I shall post the executable to comp.binaries.ibm.pc in a couple of days
Time permitting I shall post the sources to comp.sources.misc. However
the sources are available on uunet.uu.net in the comp.sources.unix
(and should be there on other places where that group is archived) under
volume10. On UUNET the files are :
	comp.sources.unix/volume10/ptoc/part[01-13].Z
The fixes are small and if anybody should want those send me mail and I
shall give them to him/her.
-- 
Amit Joshi	BITNET	|	Q3696@PUCC.BITNET
		USENET	| {seismo, rutgers}\!princeton\!phoenix\!asjoshi
"There's a pleasure in being mad... which none but madmen know!" - St.Dryden