C++ interpreter for Marbelous
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
obj
src
.gitignore
LICENSE
Makefile
README.md

README.md

marbelous.cpp

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.

For more examples of Marbelous code, see the examples directory in the Python interpreter repo (written by sparr), or head over to Programming Puzzles & Code Golf Stack Exchange and search Marbelous.

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: --std=c++11).

Compiling vmarbelous (debugger)

The debugger (which shows the marbles moving throughout the board: see below) requires GTK+ 3.0, FreeType 2, Pango, and Cairo.

Run 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: --std=c++11).

If you are on Windows, I recommend using MSYS to compile marbelous.cpp.

vmarbelous printing an arch of ascending/descending numbers (written by Sparr):

Interpreter Options

The C++ interpreter has the following options:

Option Description
‑‑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.
More information/Other interpreters

Python interpreter by sparr (first Marbelous interpreter)

Javascript interpreter by es1024 (on codegolf.stackexchange.com)

Spec draft for Marbelous