C++ interpreter for Marbelous
What is Marbelous?
Marbelous is an esoteric programming language based on marbles (aka 8-bit unsigned integers) falling through a Rube Goldberg-like board, filled with various devices that manipulate the value and/or motion of the marble.
For example, in the following board,
30 is a marble with value
0x30. The marble falls down one row, is pushed right, and then falls off the bottom. Marbles that fall off the bottom are outputted to STDOUT; here,
0, which is
0x30 in ASCII, is outputted.
30 .. ==> .. .. ==> .. .. ==> .. .. \\ .. 30 .. \\ 30 .. .. (0 is outputted)
Marbelous was conceived in Programming Puzzles & Code Golf's chat room (The Nineteenth Byte). Discussion about the spec was then continued in a dedicated chatroom. The original idea for Marbelous came from cjfaure; Martin Büttner, Nathan Merril, overactor, sparr, githubphagocyte, es1024, and VisualMelon provided additional input on language design.
Compiling marbelous (interpreter)
If you have
make on your system, just run
make bin/marbelous. Alternatively, you can just compile and link all the
.cpp files in source (no external libraries are used for the interpreter). Note that this interpreter is written to C++11, so you may need to pass a flag to your compiler to specify this (for gcc:
Compiling vmarbelous (debugger)
The debugger (which shows the marbles moving throughout the board: see below) requires GTK+ 3.0, FreeType 2, Pango, and Cairo.
make bin/vmarbelous to compile. Note that this interpreter is written to C++11, so you may need to pass a flag to your compiler to specify this (for gcc:
If you are on Windows, I recommend using MSYS to compile marbelous.cpp.
vmarbelous printing an arch of ascending/descending numbers (written by Sparr):
The C++ interpreter has the following options:
|‑‑help||Display help information|
|‑v[vv]||Change verbosity level (default 0); add more v's to increase verbosity. Interpreter only.|
|‑‑enable‑cylindrical, ‑‑disable‑cylindrical||Enable or disable cylindrical boards (default disabled). If disabled, marbles falling off the side of the board are destroyed. If enabled, marbles falling off the side of the board reappear on the other side.|