Skip to content

harehare/bf.mq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainfuck Interpreter in mq

A Brainfuck interpreter implemented in the mq.

Overview

This project provides a complete Brainfuck interpreter that can execute Brainfuck programs with customizable memory size and input handling.

Files

  • bf.mq - The main Brainfuck interpreter implementation
  • run.sh - Shell script wrapper for easy execution

Usage

Using the shell script

./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)

Examples

Hello World:

./mq-bf '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.' '' 10

Get help:

./mq-bf --help

Direct mq usage

mq 'import "bf" | bf::run("program_code", "input", memory_size)'

Brainfuck Commands

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

About

A Brainfuck interpreter implemented in the mq

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages