public
Description: a ruby-to-pyc compiler
Clone URL: git://github.com/why/unholy.git
Search Repo:
why (author)
Mon May 05 11:15:26 -0700 2008
commit  7ff70885df568be45997640f65415915231a46a2
tree    8241ea9dc5de15ecf076354f3184cd47b11d419d
parent  ba5195ba609b71c23bf52969ec02763924d6a8ae
unholy /
name age message
folder COPYING Mon May 05 10:06:15 -0700 2008 * COPYING: an mit license. [why]
folder README Mon May 05 10:01:20 -0700 2008 * README: note about needing ruby 1.9 and pyth... [why]
folder bin/ Mon May 05 02:13:31 -0700 2008 * lib/unholy.rb: require the tiny `pickle` lib. [why]
folder decompyle/ Mon May 05 07:52:52 -0700 2008 * decompyle/: remove verbose debugging output,... [why]
folder lib/ Mon May 05 11:15:26 -0700 2008 * lib/unholy/pyasm.rb: warning if you have no ... [why]
folder python/ Mon May 05 09:50:23 -0700 2008 * lib/unholy/pyasm.rb: the `unpop` logic was c... [why]
README

          $ UNHOLY $

  Compile Ruby to Python bytecode.
  And, in addition, translate that
  bytecode back to Python source
  code using Decompyle (included.)

  Requires Ruby 1.9 and Python 2.5.


         $ INSTALL $

  First, install decompyle:

  > cd decompyle
  > python setup.py build
  # python setup.py install

  Then, in the main directory, use
  the tools.

            ---

  To compile Ruby to a .pyc:

  > bin/unholy test.rb
  > python test.rb.pyc
  
            ---

  To translate to Python:

  > decompyle test.rb.pyc > test.py

            ---

  And, to view the disassembled
  bytes:
  
  > bin/py-dis test.rb.pyc

  Thanks to Ned Batchelder for his
  rather juicy posts on dissecting
  Python bytecode.  It is only too
  bad that a Rubyist got a hold of
  them. :(

        $ POTION $

  Now, image if Ruby and Python
  were to combine into something
  new.  Let's call it "potion":

  > potion test.py
  HELLO FROM PYTHON
  > potion test.rb
  KONNICHIWA FROM RUBY

  You know, it's crazy that Python
  and Ruby fans find themselves
  battling so much.  While syntax
  is different, this exercise
  proves how close they are to
  each other!  And, yes, I like
  Ruby's syntax and can think much
  better in it, but it would be
  nice to share libs with Python
  folk and not have to wait forever
  for a mythical VM that runs all
  possible languages.