/crystaLyne

An interpreter for the esolang Ly written in Crystal

Primary LanguageCrystalMIT LicenseMIT

crystaLyne

Formally, this is an LL parser (with lookahead I can't be bothered to calculate) hooked up to an interpreter for the esolang Ly (see also), the full (read: comprehensive) documentation of which I have yet to write.

Compilation

Under macOS/Linux/WSL, follow the instructions here to install the compiler, and then run make.sh in the top level of the repository.

Under Windows... it's probably best not to try, but it is possible to cross-compile to Windows from other platforms.

Usage

crystalyne <filename> [-d] [-s] [-ti] [-t=0.0] [-b=0]
Note that `filename` may instead be a appropriately delimited string representing the Ly program to run

Flags:
-d, --debug     : Output the current stack along with various other debug information after the execution of each instruction
-s, --slow      : Wait for the Enter key to be pressed before advancing to the next instruction (step-through)
-ti, --timeit   : Display the total execution time after the program is finished [NB: yes, almost all the other flags break this]
-t TIME, 
  --time=TIME   : Set the amount of time to sleep between each instruction
-b N,
  --benchmark=N : Run the program N times and average the execution time [if this is passed, --timeit will do nothing]
-h, --help      : Show the help text (a more concise yet less informative version of this)

Development

Again, just as with compiling on Windows, it's probably best not to try to decipher what I've written here - though efforts to make the huge case-when statement in LyStack more concise without sacrificing even more readability would be appreciated.

For those that wish to help out, the main interpreter source is in lib/interpreter.cr; the frontend (where I wrote the OptionParser, for those that know the language well enough) is in src/ly_interpreter.cr.

Contributors

Thanks to

Both of these shards are used for tests, and crystaLyne doesn't depend on them.