1 |
On 01/24/2011 05:34 PM, Mark Knecht wrote: |
2 |
> Hello, |
3 |
> I'm wondering if there are any generic sorts of code translation |
4 |
> tools in portage wherein I could translate from an 'uncommon' language |
5 |
> no one here is likely to use (EasyLanguage) into C? |
6 |
> |
7 |
> As an example I've attached a little EL function that takes |
8 |
> buy/sell command data an puts it away in an array for safe keeping. |
9 |
> What tools are out there, if any, that might allow me to describe how |
10 |
> EL works and then the tool does the conversion? |
11 |
|
12 |
Since no one else has given you the bad news, this is basically |
13 |
impossible if you care that the two programs behave the same. |
14 |
|
15 |
For any particular program, the best you can do is rewrite it by hand |
16 |
after creating a battery of unit tests. The alternative is to compile |
17 |
your source language to a common low-level language, and then decompile |
18 |
back to your target language. |
19 |
|
20 |
Unfortunately, unless your common low-level language is some sort of |
21 |
bytecode with additional metadata (you can translate between .NET |
22 |
languages for example), the output from the decompiler is going to look |
23 |
like garbage. |