https://github.com/pingbird/stackvm
A curiously fast Brainfuck runtime
https://github.com/pingbird/stackvm
Last synced: about 1 year ago
JSON representation
A curiously fast Brainfuck runtime
- Host: GitHub
- URL: https://github.com/pingbird/stackvm
- Owner: pingbird
- License: bsd-3-clause
- Created: 2020-08-23T15:03:43.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-10T23:32:31.000Z (about 4 years ago)
- Last Synced: 2025-06-10T11:12:53.511Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 465 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 ] [-e ] [-m ] [-p ] [-q] [-d ]
Parameters:
-h, --help print this help message
-w, --width width of cells in bits
default = 8
-e, --eof value of getchar when eof is reached
default = 0
-m, --memory how much virtual memory to reserve to the left and right
default = 128MiB,128MiB
-p, --profile enable profiling of build and execution
-q, --quiet suppress printing profiling info to the console
-d, --dump 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
```