A Brainfuck interpreter implemented in the mq.
This project provides a complete Brainfuck interpreter that can execute Brainfuck programs with customizable memory size and input handling.
bf.mq- The main Brainfuck interpreter implementationrun.sh- Shell script wrapper for easy execution
./mq-bf [program] [input_str] [memory_size]Parameters:
program- Brainfuck program code (default: "")input_str- Input string for the program (default: "")memory_size- Memory size in cells (default: 1000)
Hello World:
./mq-bf '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.' '' 10Get help:
./mq-bf --helpmq 'import "bf" | bf::run("program_code", "input", memory_size)'| Command | Description |
|---|---|
> |
Increment the data pointer |
< |
Decrement the data pointer |
+ |
Increment the byte at the data pointer |
- |
Decrement the byte at the data pointer |
. |
Output the byte at the data pointer |
, |
Input a byte and store it at the data pointer |
[ |
Jump forward after matching ] if current cell is zero |
] |
Jump back after matching [ if current cell is nonzero |