commit d15375b5c542aba81333671d08691bc67153b30b
tree fa08e76ff0ec2b1b6e5ad420808c57c32373228a
parent aa1939a1878fbe48fb9b743a39e8a42da2f83d02
tree fa08e76ff0ec2b1b6e5ad420808c57c32373228a
parent aa1939a1878fbe48fb9b743a39e8a42da2f83d02
unholy /
| name | age | message | |
|---|---|---|---|
| |
COPYING | Mon May 05 10:06:15 -0700 2008 | [why] |
| |
README | Mon May 05 20:17:26 -0700 2008 | [why] |
| |
bin/ | Mon May 05 02:13:31 -0700 2008 | [why] |
| |
decompyle/ | Mon May 05 07:52:52 -0700 2008 | [why] |
| |
lib/ | Thu May 08 08:16:04 -0700 2008 | [why] |
| |
python/ | Mon May 05 20:17:26 -0700 2008 | [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
> PYTHONPATH=python \
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.




