Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Converting Ruby 1.9 Bytecode to Python

By Peter Cooper / May 5, 2008

rubytopython.jpg

Never one to let us down on the ingenuity front, Why The Lucky Stiff (author of the Poignant Guide and creator of Shoes) is busy working on a system that can convert Ruby 1.9 bytecode to Python bytecode (and from there into regular Python by way of Python's decompilation facilities). It's exactly the sort of thing that could take off with more eyes looking at it, and Why has made it available on GitHub. This technique isn't likely to unite Python and Ruby in any deep and meaningful way (to the point of a shared interpreter), but the research and experiments involved are worth a try.

Comments

  1. Geoffrey Grosenbach says:

    I've often wondered why projects like YARV and Rubinius use their own bytecode format. Even if they hope to optimize for Ruby, there may be other benefits to using bytecodes for an existing VM, such as JRuby has done.

  2. Peter Cooper says:

    I'd say there's not a great advantage to using existing bytecode formats if your virtual machine is going to act in a substantially different way to others. The JVMs instruction set, for example, is all stack-based, whereas Parrot's is register-based (more x86 like). I'm not sure what route YARV and Rubinius have taken but imagine there are enough differences to make it worthwhile starting with a fresh bytecode format.

    It seems, however, that Python and Ruby could certainly be closer given the similarities between their virtual machines..

Other Posts to Enjoy

Twitter Mentions