An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# stackvm - A brainfuck VM

![](https://user-images.githubusercontent.com/2466461/92068152-23277880-ed74-11ea-8cf9-c9f9d85afc27.png)

## 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
```