Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 2, 2019. It is now read-only.
/coldrubyPublic archive

ColdRuby is a compiler of Ruby 1.9 MRI bytecode, and a runtime written in JavaScript to aid in execution of Ruby code. It also includes a C++ executable using very fast V8 scripting engine and native extensions for regular expressions, fibers and more.

License

NotificationsYou must be signed in to change notification settings

whitequark/coldruby

Repository files navigation

Overview

ColdRuby consists mainly of two distinctive parts: the bytecodecompiler, which produces JavaScript code from YARV bytecode and runs onYARV itself, and the Ruby runtime library implemented in plainJavaScript. There is no direct link between parts; it is perfectlypossible to pre-compile a bunch of source files and then load them inany ECMAScript capable agent, like Web browser, Flash applet or astandalone runner.

There is also an executable, which incorporates V8 JavaScript engineand allows standalone execution of Ruby scripts. It has its ownextension interface, which is used to provide native-dependingfunctionality to the runtime: regular expressions, fibers and more.

API

The API provided is, by an interesting coincidence, very similar to theRuby C API (I, the author of ColdRuby, personally think that it is oneof the best C APIs ever). It still may undergo major changes, so itwon't be documented now; you can look in a generic runtime classimplementation (likeruntime/05_hash.js) or in the Ruby runtimeitself (runtime/01_ruby.js).

Usage

Currently there are two modes of operation: standalone and pureJavaScript. Both require the Ruby 1.9 installation. As there may besome differences in internal format of bytecode, which is parsed inColdRuby, I should note that everything is currently tested on1.9.2-p136. The bytecode version used is[1, 2, 1].

Using standalone interpreter

Standalone interpreter is based on V8 engine; as such, you will needthe developer files for that library. They are contained in packagelibv8-dev on Debian.

The build process is based on standard autoconf utilites.

If you've checked out the git version, you will need to runautoreconf -iin the root of repository; if you do not want to install it to your system,but rather use from the build directory, you should pass--enable-developer-mode flag to configure script.

To build, just run./configure && make.

After the build has finished, you can execute scripts with the binary locatedat./coldruby/coldruby.

Compiling to pure JavaScript

You can use the executable to generate the code for Chrome browser or NodeJS.To do that, you'll need to pass the-s option. If you'll specify a filename(note that getopt expects it to be joined with the option, i.e.-sfilename.js), the compiled code will be written to that file. Then, youcan run it in your favorite JavaScript interpreter.

Some examples of code runnable in browser and NodeJS will be provided oncethe extension API will mature.

About

ColdRuby is a compiler of Ruby 1.9 MRI bytecode, and a runtime written in JavaScript to aid in execution of Ruby code. It also includes a C++ executable using very fast V8 scripting engine and native extensions for regular expressions, fibers and more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp