From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Pi9dT-0006OK-Io for garchives@archives.gentoo.org; Wed, 26 Jan 2011 17:58:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A9D91E08F8; Wed, 26 Jan 2011 17:56:40 +0000 (UTC) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 60462E08F8 for ; Wed, 26 Jan 2011 17:56:40 +0000 (UTC) Received: by wyf22 with SMTP id 22so1515558wyf.40 for ; Wed, 26 Jan 2011 09:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=hlZa1cr5j9OsVEYqBfu6ybHTqvMSQVo788BMwLTVSqk=; b=PMv0CAFJGmg+W/DHekoksYZzJz2c+eS1sLW/0EzJLikPHbIEdlOYnEzE8mQBpaAqLb LMHqSscFWdLicYLmiWXBOB5w05Z9za36elMolAyZtMQRflkfF1Iok+9IhwcxQ3BQf+h4 mOh14qPTJqvgVwbaLTJyoIC6a24TCTWm4+DiU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=KZ14o1Uw19b+ldr9KAg2DuV/w0rZykZ46NgmQfMkOAXvfdNn4O13TwhFbKTWV7NRzx uBMasUtoOuFajteN88bteXfq4TC+6fiiWRfEmYTvtmFZEH6QbxE+6Te5DGklTNcV+BQd 3kweoVC3esIRqI807/6vP+3ZYTtK7FZwW1tD0= Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.217.1.198 with SMTP id n48mr771657wes.59.1296064599322; Wed, 26 Jan 2011 09:56:39 -0800 (PST) Received: by 10.216.16.21 with HTTP; Wed, 26 Jan 2011 09:56:39 -0800 (PST) In-Reply-To: <4D3F75A4.7070100@orlitzky.com> References: <4D3F75A4.7070100@orlitzky.com> Date: Wed, 26 Jan 2011 09:56:39 -0800 Message-ID: Subject: Re: [gentoo-user] [OT] - Code translation tools? From: Mark Knecht To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 0497e5093f6d048e22c49b22567723da On Tue, Jan 25, 2011 at 5:15 PM, Michael Orlitzky wr= ote: > On 01/24/2011 05:34 PM, Mark Knecht wrote: >> Hello, >> =C2=A0 =C2=A0I'm wondering if there are any generic sorts of code transl= ation >> tools in portage wherein I could translate from an 'uncommon' language >> no one here is likely to use (EasyLanguage) into C? >> >> =C2=A0 =C2=A0As 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