Skip to content

daneelsan/brainfuckz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brainfuckz

A Brainfuck interpreter written in Zig.

$ brainfuckz help
Usage: brain [command]

 Commands:

 code [BRAIN]     Give brainfuck code to execute
 file [PATH]      Execute the code found in a .brain file
 help             Print this help message and exit
 test             Enters interactive mode

Example

code

Run a simple Brainfuck program that prints the letter 'H':

$ brainfuckz code '>+++++++++[<++++++++>-]<.'
H

Print the classic "Hello world!":

$ brainfuckz code '>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]
>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++
.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.'
Hello world!

file

Run one of the many Brainfuck programs stored in the program/ subfolder:

$ brainfuckz file program/MorseTranslate.brain
Brainfuck
-... ..--.- ..--.- ..--.- ..--.- ..--.- ..--.- ..--.- ..--.- -...-

A Mandelbrot program:

$ brainfuckz file program/Mandelbrot.brain

image

test

Enter a simple Brainfuck REPL and test simple code:

$ brainfuckz test
brainfuckz> >+++++++++[<++++++++>-]<.
H
brainfuckz>

Build

# Pull down this project
$ git clone https://github.com/daneelsan/brainfuckz.git
$ cd brainfuckz

# Tested on
$ zig version
0.11.0

# Build in ReleaseFast mode to speed up performance by >10x compared to the default debug mode
$ zig build -Doptimize=ReleaseFast

# For convenience, copy the executable to the top-level directory
$ cp zig-out/bin/brainfuckz brainfuckz

Resources

About

A Brainfuck interpreter written in Zig

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages