Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An interactive bytecode console for Rubinius

tree: 2466c7d049

Fetching latest commit…

Cannot retrieve the latest commit at this time

Readme.md

rexpl

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.

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.

Something went wrong with that request. Please try again.