From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 13AD9BC57 for ; Sat, 20 Nov 2010 19:05:58 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgwBAE6d50xKfVIukGdsb2JhbACWBoxXCBUBAQEBCQkMBxEDH6EDi3sBBY1VAQSFSw X-IronPort-AV: E=Sophos;i="4.59,229,1288566000"; d="scan'208";a="67556223" Received: from mail-ww0-f46.google.com ([74.125.82.46]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Nov 2010 19:05:58 +0100 Received: by wwf26 with SMTP id 26so4130301wwf.3 for ; Sat, 20 Nov 2010 10:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:references :in-reply-to:subject:date:organization:message-id:mime-version :content-type:content-transfer-encoding:x-mailer:thread-index :content-language; bh=96ZWjXrSSA74c3dOyc2pApfkdA4Hy3XC118y8nIk6UM=; b=Pc7IusCfY5L6lHGF7lLN5UfzYVsZU81rm6T4wzZmdgZf2eqj3cC/luj1akRztim2DR dAwVZFJbIcLa/qXS1tP7yeatrxuBiZeR1KUaRjReiFukOVGpnXiuV/ws6vOtXvqr1ja5 qLYuAVvbNlDAOzbzVuqW7ZU3PImlSthelTznc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:references:in-reply-to:subject:date:organization :message-id:mime-version:content-type:content-transfer-encoding :x-mailer:thread-index:content-language; b=wppykFBHT0fKjk76O4ASSsQOST2uc9GVyicR0TKdLvKR+3mbQdLwkDTl8COwUAo36/ pvFdV+q/E8iRvyRmBaJPKgbTbNziRq0X+CNzzqHjZcfqqr2ZQSMGj2KZqNveBY3hx6xX xI+JIqQuBIzobw8tYdes9gcCIxlnAJbnnbt7Y= Received: by 10.216.52.70 with SMTP id d48mr2228043wec.92.1290276357270; Sat, 20 Nov 2010 10:05:57 -0800 (PST) Received: from WinEight ([87.113.160.118]) by mx.google.com with ESMTPS id w29sm1423932weq.43.2010.11.20.10.05.55 (version=SSLv3 cipher=RC4-MD5); Sat, 20 Nov 2010 10:05:56 -0800 (PST) From: Jon Harrop To: "'Yoann Padioleau'" Cc: References: <980786.74593.qm@web111507.mail.gq1.yahoo.com> <023DB1B5-B4D6-4C2A-AAF6-2368F93BEBB6@wanadoo.fr> <201011201619.47211.vincent.balat@pps.jussieu.fr> <6366332A-5DAC-469D-94A4-744E569CA3B0@wanadoo.fr> <04e801cb88d5$7d9a58f0$78cf0ad0$@com> <1BAB09A3-7235-4744-8401-06BA5E24A464@wanadoo.fr> In-Reply-To: <1BAB09A3-7235-4744-8401-06BA5E24A464@wanadoo.fr> Subject: RE: [Caml-list] [Was: OCamlJit 2.0] Date: Sat, 20 Nov 2010 18:05:50 -0000 Organization: Flying Frog Consultancy Message-ID: <04ee01cb88dd$91c04d00$b540e700$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcuI2alP1OnxorWPQSmNbo5a1nyO9AAAuihA Content-Language: en-gb X-Spam: no; 0.00; compiler:01 translating:01 kloc:01 kloc:01 ocaml:01 ocaml:01 variants:01 translating:01 cheers:01 2.0:98 20,:98 frog:98 churn:98 polymorphic:01 wrote:01 Yoann Padioleau wrote: > On Nov 20, 2010, at 9:08 AM, Jon Harrop wrote: > >> Do we have example of big companies porting their whole codebase to > >> another language ? > > > > Yes, of course. Companies modernise all the time. We have a client > > who just > > started porting 1MLOC of C++ to F#. > > How they do that ? Are they using compiler frontends to assist them > in automatically translating part of the code to F# ? We do it for them for a fee, using magic. We tried automated translation (from Fortran) but it is usually easier just to knuckle down by hand. Old code bases are usually 90% cruft anyway. That 1MLOC of C++ could have been 100kLOC of C++ but now it will be 10kLOC of F# instead. > > Flying Frog have ported hundreds of thousands of lines of OCaml to F#. > > OCaml and F# are very similar language, so such porting does not look > that hard. Yes. The main thing is that OCaml source is nice and readable so it is easy to translate even if it makes heavy use of features that don't port (polymorphic variants, macros). C++ source can be a nightmare so you really need to pin down a precise specification for what it does using advanced techniques like poking it with a stick. > Translating from C++ to F#, or from PHP to Java seems more > complicated. > I wonder what kind of techniques people have developed to help such > language-to-language translation. The only viable option seems to be to do it by hand. You can churn through an enormous amount of code when you put your mind to it... Cheers, Jon.