An interactive bytecode console for Rubinius
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

rexpl Build Status

rexpl is a sandbox to experiment and play with the Rubinius Virtual Machine and its bytecode instructions. It comes wrapped in a REPL (Read-Eval-Print Loop) à la IRB, so that anytime you can open a terminal, fire up rexpl, and start playing with instant feedback.

This intends to be a fun tool to use when learning how to use Rubinius bytecode instructions, for example when bootstraping a new language targeting the Rubinius VM for the first time.

Its main feature is stack introspection, which means you can inspect what the stack looks like after each step of your instruction set.


How to use it?

Needless to say, rexpl runs only on Rubinius. Thus, your first step is to install it. Go to the Rubinius website to find how, or if you are using RVM, just follow this instructions.

$ gem install rexpl
$ rexpl

Now you should see a welcome banner and an IRB-like prompt, and you're good to go! Just start typing some VM instructions and see what happens!

There are three extra commands to take advantage of the stack introspection:

  • list lists the instruction set of the current program.
  • reset empties the instruction set and starts a new program.
  • draw prints a visual representation of the stack after each instruction of your program.

When to use it?

Imagine you are bootstrapping a new language targeting the Rubinius VM and you just implemented a particular AST node, but when you try to run the tests, you keep getting nasty stack validation errors. Net stack underflow? What the heck does this even mean? Where the hell is that extra pop? Did this or that instruction consume stack? Or maybe produce it? Oh fuck it, let's go fishing.

Don't panic. You always have your friends pen and paper ready to help you out, Read through the source code, and knowing what each instruction does, try to follow along and draw what the stack looks like at each step (does that sound familiar to you?). Or just fire up rexpl.

Who's this

This was made by Josep M. Bach (Txus) under the MIT license. I'm @txustice on twitter (where you should probably follow me!).