Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
automatic code conversion from Ruby to C ?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Axel Etzold, post: 4622647"] Dear Brian, well, the examples in the RubyToC gem as well as the Cplus2ruby gem suggested that maybe, C or C++ code could be produced from Ruby scripts that are fed into them (for some subset of Ruby). But I have not been able to translate my Ruby scripts just like that into C using these softwares. I am not looking for swig or an extension of Ruby by C, but a way of producing C/C++ code from a Ruby script containing some magical part that saves me the trouble of declaring all the variables, assigning memory etc and all these things that make writing C/C++ so tedious in comparison with Ruby ... For the project I am working on right now, this is not so dramatic. I just wanted to know if I had missed something that would spare me all the troubles of C/C++ development ;-) I am of course aware that there are conceptual differences between languages ... Maybe a conversion tool between programming languages would then need to be able to capture some of these by analyzing a lot of parallel code from detailed guidebooks explaining how to program task X "idiomatically" in both languages. In automated translation between natural languages, results used to be poor as long as individual words were translated -- there is the famous joke that a 1950ies automated translation of "out of mind, out of sight" into Russian and back gave "invisible idiot". On the other hand, it is possible to summarize texts automatically and return their gist quite well using statistical methods, such as Latent Semantic Analysis (there's the classifier gem in Ruby implementing this for English texts). This will map count word occurrences in each sentence or paragraph of a text (after having removed the most frequent ones, that are likely to occur in any text), and perform some operations on the resulting matrix, so that sentences can be mapped to some object from linear algebra which allows to classify them and introduce distances between them. If you now have a long text, say, a novel in English, and its (human-made) translation into Russian, it should be possible to extract some correspondence between word groups, words, expressions in English to those in Russian from this training set, including several alternative ways to express approximately the same idea in either language. I am wondering whether it's possible to do something similar between programming languages and what could be the connection between them (S-expressions?) That's of course more an academic question than a practical one, but if someone had done it already, and I'd be able to write C in Ruby with an automatic translator, I'd still like to know ;-) From all the responses I got, this doesn't seem to be the case ... and I'd truly expect that to be a huge undertaking as well. Thank you to all who responded to my question! Best regards, Axel [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
automatic code conversion from Ruby to C ?
Top