A very old Ruby parser/bytecode VM.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Yuki Izumi ac92d33f37
Make it compile again.
3 years ago
include Completing the rename: translator is now parser; program is now vm. 3 years ago
module Putting things in directories. Very important. 3 years ago
parser Make it compile again. 3 years ago
ruby Add output directories. 3 years ago
tests MatchData: adding working captures and [] (though no bounds checking). 3 years ago
vm Make it compile again. 3 years ago
Makefile Make it compile again. 3 years ago
README.textile Too visually sparse. 3 years ago
TODO Regex is underway. 3 years ago

README.textile

h1. RubyEx

h2. What, why, how?

RubyEx is my attempt at creating a Ruby parser, byte-code generator and VM for that byte-code.

I've never written a parser, byte-code or VM before, and hence the entire codebase is often completely refactored at once in some commits.

I am an avid Rubyist, and my only motivating factor to write this is since I thought it'd be a good bit of fun.

Originally my plan was to write an interpreter for the byte-code to run as a kernel module (speed?!) - I may still try to do it, but that's risky like nothing else and a complex beast to run in kernel space that we'd all rather not. So, RubyEx turned out instead just to be my parser and VM.

The parser is written using flex/bison, and generates byte-code from an object-oriented AST. The AST can also produce messy Ruby instead, and the current design means it wouldn't be too hard to add other forms of output for the AST.

The VM is written in C++, and is a learning experience for me as I learn just how much Ruby gives us, by having to implement it myself.

h2. Now?

At the moment, a fairly large subset of the Ruby core is implemented, to name a few major points:

* Defining classes and methods,
* blocks,
* @eval@,
* exceptions,
* string interpolation, and
* Ruby's class hierarchy and introspective abilities.

A simple @irb@ program (see "@ruby/test_irb.rb@":http://github.com/kivikakk/rubyex/tree/master/ruby/test_irb.rb) can run in both MRI and RX equally. The main work now is on writing the standard library that surrounds Ruby. It would also be nice to support linkage with Ruby's C library extensions.