Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How do you translate from C++ to Pascal ?

  1. #1

    How do you translate from C++ to Pascal ?

    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?

  2. #2

    How do you translate from C++ to Pascal ?

    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.

  3. #3

    How do you translate from C++ to Pascal ?

    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.

  4. #4

    How do you translate from C++ to Pascal ?

    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

  5. #5

    How do you translate from C++ to Pascal ?

    Quote Originally Posted by JSoftware
    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
    WOW!! :shock:
    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.
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  6. #6

    How do you translate from C++ to Pascal ?

    This is a handy doc...

    http://www.stonehill.edu/cs1/TE/notespdf.htm

    Pascal to C++ (Easier to understand for us Pascalies)

  7. #7

    How do you translate from C++ to Pascal ?

    Quote Originally Posted by Robert Kosek
    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.
    But how to do it without mistakes?
    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.

  8. #8

    How do you translate from C++ to Pascal ?

    Quote Originally Posted by K4Z
    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.
    I can write that function by myself. But i don't know how ODE generate information about contacts.

  9. #9

    How do you translate from C++ to Pascal ?

    Quote Originally Posted by Zampoteh
    Quote Originally Posted by Robert Kosek
    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.
    But how to do it without mistakes?
    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.
    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:
    The remaining part should be clean enough to pass to a translation software or to do it by hand
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  10. #10

    How do you translate from C++ to Pascal ?

    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
    Attached Images Attached Images
    Last edited by LP; 10-07-2016 at 06:16 PM. Reason: fixed url, added screenshot

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •