Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] - Code translation tools?
Date: Wed, 26 Jan 2011 17:58:27
Message-Id: AANLkTikTTg5t4BMgWacmNOObi9kRf6DYWH_NiFDfqc5N@mail.gmail.com
In Reply to: Re: [gentoo-user] [OT] - Code translation tools? by Michael Orlitzky
1 On Tue, Jan 25, 2011 at 5:15 PM, Michael Orlitzky <michael@××××××××.com> wrote:
2 > On 01/24/2011 05:34 PM, Mark Knecht wrote:
3 >> Hello,
4 >>    I'm wondering if there are any generic sorts of code translation
5 >> tools in portage wherein I could translate from an 'uncommon' language
6 >> no one here is likely to use (EasyLanguage) into C?
7 >>
8 >>    As an example I've attached a little EL function that takes
9 >> buy/sell command data an puts it away in an array for safe keeping.
10 >> What tools are out there, if any, that might allow me to describe how
11 >> EL works and then the tool does the conversion?
12 >
13 > Since no one else has given you the bad news, this is basically
14 > impossible if you care that the two programs behave the same.
15 >
16 > For any particular program, the best you can do is rewrite it by hand
17 > after creating a battery of unit tests. The alternative is to compile
18 > your source language to a common low-level language, and then decompile
19 > back to your target language.
20 >
21 > Unfortunately, unless your common low-level language is some sort of
22 > bytecode with additional metadata (you can translate between .NET
23 > languages for example), the output from the decompiler is going to look
24 > like garbage.
25
26 Michael,
27 Thanks for the inputs. It gives me more to think about.
28
29 In this case the input language is interpreted, not compiled. The
30 trading platform interprets the program and internally turns it into
31 buy & sell operations. (Not the piece of code I supplied - that was
32 just a small function.) Unfortunately, as the language is proprietary
33 to the trading platform there isn't a way to go to any common
34 low-level language.
35
36 The 'battery of tests' would be, I think, the trading program being
37 executed on a certain market, producing a certainly list of buy & sell
38 operations and a specific gain or loss. It would be quite easy to
39 compare the outcome because it's nothing more than a list of trades.
40 If the translated code generates the same list then it works. If not,
41 I dig into why. This part of the task seems relatively straight
42 forward to me.
43
44 I was mainly hoping to find a tool that might generate _reasonable_
45 C code, even if it's not perfect. If the C code compiles and runs then
46 I could determine what works, what doesn't, and start fixing things.
47 I'm not a C programmer and haven't touched that language in at least
48 15 years so anything that moves me forward would be helpful.
49
50 Again, I do appreciate your inputs. If this extra info gives you
51 any new ideas please let me know.
52
53 Cheers,
54 Mark

Replies

Subject Author
Re: [gentoo-user] [OT] - Code translation tools? Michael Orlitzky <michael@××××××××.com>