brainfuck interpreter
brainfuck cli rust
5

Configure Feed

Select the types of activity you want to include in your feed.

103 4 2

Clone this repository

https://tangled.org/digi.rip/tachyon https://tangled.org/did:plc:einebxrxfych2slzq7soxsyb
git@tangled.org:digi.rip/tachyon git@tangled.org:did:plc:einebxrxfych2slzq7soxsyb

For self-hosted knots, clone URLs may differ based on your setup.



README.md

tachyon#

a brainfuck interpreter written in rust.

install#

pre-built binaries are available under tags.

download the archive for your platform, then:

# extract
tar xzf tachyon-<version>-<arch>.tar.gz

# (optional) move to somewhere on your PATH
mv tachyon ~/.local/bin/
archive platform
tachyon-*-aarch64-apple-darwin.tar.gz macOS (Apple Silicon)¹
tachyon-*-aarch64-linux-gnu.tar.gz Linux (ARM64)²
tachyon-*-x86_64-linux-gnu.tar.gz Linux (x86_64)²

¹ if macOS complains about not being able to open the binary due to lack of developer verification, run: xattr -d com.apple.quarantine path/to/tachyon

² linux builds are untested as of right now! you have been warned!

alternatively, build from source:

cargo build --release

usage#

tachyon path/to/your/script.bf [OPTIONS]

use wrapping data pointer and raw i/o:

tachyon script.bf -d wrap -u raw

use raw input and ascii output:

tachyon script.bf -d wrap -i raw -o ascii

set a custom tape size of 100 cells:

tachyon script.bf -l 100

crash on cell overflow instead of wrapping:

tachyon script.bf -c error

options#

flag description values
-d, --data-oob data pointer out-of-bounds behavior error (default), wrap
-c, --cell-oob cell value out-of-bounds behavior wrap (default), error
-l, --length custom tape length number (default: 30,000)
-i, --input-type set input mode ascii (default), raw
-o, --output-type set output mode ascii (default), raw
-u, --io-type set both input and outtput ascii (default), raw
-t, --trace enable instruction tracing with optional delay in ms default: false, 0

roadmap#

features and milestones! nothing is guaranteed to happen. less of a roadmap and more a list of things i'd like to do

this is all pretty overkill but im using this project as a way to learn stuff

cli#

  • argument parsing: possibly switch to clap for nicer cli experience
  • behavior flags: overrides defaults in code (& possibly eventually in config?)
    • set data pointer & cell value behavior
    • set custom tape size
  • 8-bit i/o: add 8-bit input/output option alongside ascii default
    • monomorphization: implement input/output strategy for minor optimization gains
  • config file: set up per-project config file for input & output

out-of-bounds behaviors#

  • data pointer behavior
    • error (default): crash when moving past tape boundaries
    • wrap: going out of bounds wraps around to start/beginning
  • cell value behavior
    • wrap (default): 0 - 1 = 255
    • error: crash on overflow/underflow

better diagnostics#

  • errors: switch to miette for richer error display with source snippets
  • tracing: cli flag to print state of vm/tape after every instruction

visualization#

  • real-time cell visualization: tui showing tape being adjusted and data pointer moving in real time at adjustable speed
  • wasm: compile to wasm for browser-based frontend?

debugging#

  • step debugger: REPL-style debugger with breakpoints, cell inspection, and instruction stepping

maintenance#

  • comprehensive testing: for all instructions and out-of-bounds behaviors
  • benchmarking: use criterion to track performance?