Skip to content

pingbird/stackvm

Repository files navigation

stackvm - A brainfuck VM

Setup

Requirements:

  • CMake
  • LLVM
  • A C++ compiler

Pull in submodules:

git submodule update --init

Build:

mkdir build
cd build
cmake ..
make -j12

Usage

Usage:
    stackvm [-h] [-w <bits>] [-e <value>] [-m <size>] [-p <count>] [-q] [-d <dir>] <program>
Parameters:
    -h, --help             print this help message
    -w, --width <bits>     width of cells in bits
                           default = 8
    -e, --eof <value>      value of getchar when eof is reached
                           default = 0
    -m, --memory <size>    how much virtual memory to reserve to the left and right
                           default = 128MiB,128MiB
    -p, --profile <count>  enable profiling of build and execution
    -q, --quiet            suppress printing profiling info to the console
    -d, --dump <dir>       dumps intermediates into the specified folder

Architecture

main.cc    - Command line interface to the interpreter
runtime.cc - Linkable runtime to native code generated by backend
src/bfvm         - Public facing API
src/bf           - High level brainfuck (HBF) manipulation
src/ir           - SSA IR graph implementation and builder
src/ir_print     - Pretty printer for IR
src/lowering     - Lowers HBF into IR
src/opt_fold         - Expression fold engine
src/opt_resolve_regs - Simple SSA register pruning 
src/opt_resolve_type - Lazy type resolution 
src/opt_validate     - Graph validator
src/backend_llvm - Translates StackVM IR to LLVM IR
src/jit          - Host JIT pipeline
src/diagnostics  - DI for logging and artifact dumps
src/tape_memory  - Lazy tape memory allocator

About

A curiously fast Brainfuck runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published