Project

rexpl

0.01
No commit activity in last 3 years
No release in over 3 years
Rexpl is an interactive bytecode console for Rubinius
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

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.

Rexpl

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!).