mattknox / 8ball

a ruby-to-javascript source-to-source transformer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

8ball is a source-to-source compiler from (a subset of) ruby to javascript.  The only javascript engine that it explicitly targets is V8.

The main interface for end users should be bin/8ball.

currently, you can run ./bin/8ball target/hello.rb

and get it to print out hello world.  Very little of ruby is supported yet, but the supported subset is growing fast.  Note that ./bin/8ball
is terribly slow, because it has to start jruby, compile the files, and then feed them to v8.  Most of the time tends to be spent in jruby startup.


Goals:
to support enough of ruby to run at least some parts of twitter's infrostructure.
to be substantially faster (2x+ faster) than the equivalent ruby code running in REE 1.8.7 (this version is chosen because it's what twitter runs on now.ag).
to be in production as fast as possible (hopefully within a year)

NonGoals:
8ball does not intend to support the whole of ruby-example features that probably won't be supported include method_missing, callcc, and *_eval(string).
ruby c extensions are almost certainly never going to be supported.


Approach: I intend to have a minimal core, mostly implemented in ruby, that compiles down to runnable js.

scenario:  I have a big ruby project that depends on a vendor'd rails and a bunch of gems.  How do I compile and run that?
-feed the entry point file to 8ball, let it load, compile and run everything as it needs to
-compile all the ruby files into individual js files, have node load the entry point file and then the others, as needed.
-make the whole thing one big js file (this seems problematic, but gets rid of require)



need to consider a port to ruby_parser, so that we can run without jruby

About

a ruby-to-javascript source-to-source transformer.

License:Apache License 2.0


Languages

Language:JavaScript 90.4%Language:Ruby 9.6%