On Tue, Jan 25, 2011 at 5:15 PM, Michael Orlitzky <mich...@orlitzky.com> wrote: > On 01/24/2011 05:34 PM, Mark Knecht wrote: >> Hello, >> I'm wondering if there are any generic sorts of code translation >> tools in portage wherein I could translate from an 'uncommon' language >> no one here is likely to use (EasyLanguage) into C? >> >> As an example I've attached a little EL function that takes >> buy/sell command data an puts it away in an array for safe keeping. >> What tools are out there, if any, that might allow me to describe how >> EL works and then the tool does the conversion? > > Since no one else has given you the bad news, this is basically > impossible if you care that the two programs behave the same. > > For any particular program, the best you can do is rewrite it by hand > after creating a battery of unit tests. The alternative is to compile > your source language to a common low-level language, and then decompile > back to your target language. > > Unfortunately, unless your common low-level language is some sort of > bytecode with additional metadata (you can translate between .NET > languages for example), the output from the decompiler is going to look > like garbage.
Michael, Thanks for the inputs. It gives me more to think about. In this case the input language is interpreted, not compiled. The trading platform interprets the program and internally turns it into buy & sell operations. (Not the piece of code I supplied - that was just a small function.) Unfortunately, as the language is proprietary to the trading platform there isn't a way to go to any common low-level language. The 'battery of tests' would be, I think, the trading program being executed on a certain market, producing a certainly list of buy & sell operations and a specific gain or loss. It would be quite easy to compare the outcome because it's nothing more than a list of trades. If the translated code generates the same list then it works. If not, I dig into why. This part of the task seems relatively straight forward to me. I was mainly hoping to find a tool that might generate _reasonable_ C code, even if it's not perfect. If the C code compiles and runs then I could determine what works, what doesn't, and start fixing things. I'm not a C programmer and haven't touched that language in at least 15 years so anything that moves me forward would be helpful. Again, I do appreciate your inputs. If this extra info gives you any new ideas please let me know. Cheers, Mark