GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: a ruby-to-pyc compiler
Clone URL: git://github.com/why/unholy.git
why (author)
Mon May 05 10:06:15 -0700 2008
commit  ba5195ba609b71c23bf52969ec02763924d6a8ae
tree    20d1bb09c5e56e0372da895b2f34269111a74922
parent  2219df933ad5a10e935900886a7d7b44687be621
unholy / README
100644 74 lines (49 sloc) 1.378 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
 
          $ 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.