delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/22/21:58:35

From: Clemens Valens <c DOT valensNOwkSPAM AT mindless DOT com>
Subject: Re: Borland Pascal to C translator
Newsgroups: comp.os.msdos.djgpp
Message-ID: <25d0e1ac.d7c5617f@usw-ex0107-056.remarq.com>
Lines: 27
Bytes: 834
X-Originating-Host: 195.154.148.69
Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
References: <Pine DOT A41 DOT 4 DOT 05 DOT 9909210954060 DOT 53478-100000 AT ieva01 DOT lanet DOT lv> <B0000102620 AT stargate DOT astr DOT lu DOT lv> <37E7A409 DOT A57C008D AT ma DOT tum DOT de> <37E87C23 DOT BFD AT earthlink DOT net>
X-Wren-Trace: eFh9VVRNCkALGwJGXBRcX1lrRVRTWBRLTkcZWF5BAUkOC1YIA0wDBwABEgsP
Date: Wed, 22 Sep 1999 00:43:43 -0700
NNTP-Posting-Host: 10.0.2.56
X-Complaints-To: wrenabuse AT remarq DOT com
X-Trace: WReNphoon3 937986378 10.0.2.56 (Wed, 22 Sep 1999 00:46:18 PDT)
NNTP-Posting-Date: Wed, 22 Sep 1999 00:46:18 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have tried PTOC not so long ago to convert PASCAL to C 
and it seemed to do the job. I found however that the 
generated C-code was a kind of unreadable, so I translated 
my PASCAL sources myself, using almost only search 'n' 
replace operations:

first replace all comments! 
"{", "(*" => "/*" 
"}", "*)" => "*/"
"begin" => "{"
"end;" => "}"
"if " => "if ("
" then" => ") {"
"while " => "while ("
" do" => ") {"
many for-next loops can often be replaced in one go, if you 
were consequent in your indices.

Be very careful with logical operations (and, or, etc)!

If your source is not too large, this method, although 
stupid, might be preferable.

Clemens

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019