How do you translate from C++ to Pascal ?
Any programs? I have found one : http://sourceforge.net/projects/C2pas
But that seems desolated.
So may be any ideas?
How do you translate from C++ to Pascal ?
Any programs? I have found one : http://sourceforge.net/projects/C2pas
But that seems desolated.
So may be any ideas?
Yes. Do not use an automatic translator/interpreter. On rare occasion they work well, but they almost never generate human readable code (Note that I do not consider C/C++ as human readable ) if they do function.
The best way is to just do all the footwork yourself.
I don't really trust automatic translators. You will get better, cleaner, faster code if you manually translate it. Most of the time you don't really have to understand every line and 'word' exactly, if you get the basic idea, just rewrite it in pascal.
However, if your doing something funky like translating a massive 10,000 line library, or an entire project with hundreds of units, then you'd probably have to use an automatic translator, but I think the result won't really be worth it.
I have a pet project which will ultimately(in a few decades...) be able to translate any imperative language to another
Atm it'll translate pascal to c pretty fine
Peregrinus, expectavi pedes meos in cymbalis
Nullus norvegicorum sole urinat
WOW!! :shock:Originally Posted by JSoftware
I can't wait to see it working
The best c to pascal translator I have found is c2pas32, though it does not make miracles.
The best option is to try to understand the c code meaning and port it to pascal and, if necessary, you can isolate the piece of code you can't understand and try to pass it to translator.
This is a handy doc...
http://www.stonehill.edu/cs1/TE/notespdf.htm
Pascal to C++ (Easier to understand for us Pascalies)
But how to do it without mistakes?Originally Posted by Robert Kosek
For example. I want to translate function
327 int dBoxBox
http://opende.svn.sourceforge.net/vi...87&view=markup
It is big and used many macroses.
And sometimes we really doesn't need to know how any function work. We just want to get a fast result.
I can write that function by myself. But i don't know how ODE generate information about contacts.Originally Posted by K4Z
YAY! That's huge, ugly and scary! First of all: put all these macros out of your function and translate it as pascal procedures. About macro's parameters: I'm not sure, but seems that are all float values... Try to declare it as real. :think:Originally Posted by Zampoteh
The remaining part should be clean enough to pass to a translation software or to do it by hand
Long time ago we've worked on C-to-Pascal compiler (not "translator" that just replaces C words by Pascal equivalents) while working on AsphyreSound back in 2004.
I've uploaded it for ya with all source code, in case you want to play with it. MPL 1.1 license applies.
http://www.afterwarp.net/downloads/ac2p.7z
Last edited by LP; 10-07-2016 at 06:16 PM. Reason: fixed url, added screenshot
Bookmarks