From: Mohit Sindhwani Date: 2008-10-28T12:20:54+09:00 Subject: Re: automatic code conversion from Ruby to C ? Axel Etzold wrote: > Dear all, > > I am looking for a (semi-)automatic conversion of a Ruby script to C or C++, so > that readable source code for a human C/C++ programmer is produced. > > The program should read in text from a file as a string, split and search it using regular expressions, > convert some numbers into floats and perform some calculations on them > (the latter part is done using some existing C code). > > The text file to be read has this structure: > > -------------------- > P1 > P2 23 > P4 27 > -------------------- > P2 > P3 1 > P5 457 > P6 3 > P377 56 > -------------------- > Hi Axel, My recommendation would be to 'prototype' in Ruby to establish the correct logic of what you want to achieve and then recode in C/C++ if speed is not fast enough - that's what we do for a number of things on our side. If you don't use too many Ruby-isms, your Ruby code can look a lot like the corresponding C code - of course, you'd have to rewrite the string parsing in C/C++ to suit your needs. Cheers Mohit.