Skip to content

Forensor/brainhask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainhask

Turing complete language interpreter. Based in Brainf**k.

About Brainhask

Brainhask is a tiny interpreter for the Brainf**k language. It features an inline/file input interpreter, and a REPL.

As the original language, Brainhask has only eight commands based in the following characters:

Character Meaning
> Increment the data pointer (to point to the next cell to the right).
< Decrement the data pointer (to point to the next cell to the left).
+ Increment (increase by one) the byte at the data pointer.
- Decrement (decrease by one) the byte at the data pointer.
. Output the byte at the data pointer.
, Accept one byte of input, storing its value in the byte at the data pointer.
[ If the byte at the data pointer is zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] command.
] If the byte at the data pointer is nonzero, then instead of moving the instruction pointer forward to the next command, jump it back to the command after the matching [ command.

Usage

Download the binary, open your terminal and move to the .exe path. The input file extension can be any plain text, but .bhs is used by convention.

Commands:

bhs <filename> - Executes the program passed by the input file.

bhs -i <input> - Executes the program passed by the input line.

bhs help - Prints the help message.

bhs repl - Starts the Brainhask repl. Use ':q' to quit.

Contribute

Any bugfix, idea, or request can be resolved by opening an issue.

License

MIT © Álvaro

About

Brainf**k interpreter in Haskell

Resources

License

Stars

Watchers

Forks

Packages

No packages published