1

Ruby has been around for a while now so I was wondering if there was any work being done on a compiler for it? I know that compiler design is hindered by things like Eval() so I would not expect implementations to be 100 percent accurate? My own searches have turned up sparse results.

QueueHammer
  • 10,515
  • 12
  • 67
  • 91
  • 1
    A bad compiler will create programs that are just as slow as a bad JITer - this is not something people should be putting effort into. – BlueRaja - Danny Pflughoeft Apr 02 '10 at 20:31
  • @Unicorn ~ Even a bad compiler works a basic obfuscator. There are many reasons someone could want to build a compiler besides just speed of execution, like pure academics, and many more. – QueueHammer Apr 02 '10 at 21:00

3 Answers3

3

MacRuby offers Ahead-of-Time Compilation as of v0.5. It uses LLVM to compile binaries that will run on the Objective-C runtime.

csexton
  • 24,061
  • 15
  • 54
  • 57
0

Rubinius is a JIT compiler for Ruby. A pure compiler will never exist for Ruby because the language is far too dynamic for a static compiler to work. Whatever it did internally would be incredibly ugly and would evolve towards a JIT as they tried to optimize it anyway.

gtd
  • 16,956
  • 6
  • 49
  • 65
  • 1
    I'm not real familiar with Ruby. Is it really so much more dynamic than Common Lisp, which is normally compiled? – David Thornley Apr 02 '10 at 21:04
  • Here is a good walk though of some of the ideas about what is or is not a compiled language. http://stackoverflow.com/questions/376611/why-interpreted-langs-are-mostly-ducktyped-while-compiled-have-strong-typing/376828#376828 – QueueHammer Apr 02 '10 at 21:11
0

There's Mirah, for compiling Ruby code into Java bytecode:

http://www.mirah.org/

I believe you could obfuscate your code this way.

Nakilon
  • 34,866
  • 14
  • 107
  • 142
Keith Bennett
  • 4,722
  • 1
  • 25
  • 35