Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
OCamlJit 2.0
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-11-20 (18:05)
From: Jon Harrop <jonathandeanharrop@g...>
Subject: RE: [Caml-list] [Was: OCamlJit 2.0]
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...