A command-line tool for executing Brainfuck scripts with debugging capabilities and real-time memory visualization.
- 🚀 Execute Brainfuck scripts from the command line
- 🔍 Debug mode with memory state visualization
- 💡 Breakpoint support using '#' in scripts
- 📊 Real-time execution statistics
- 📝 Comprehensive logging system
- ⚡ Infinite loop detection and prevention
- 🎯 Step-by-step execution in debug mode
- 📂 Script management in
/bf-scripts
directory
- Clone the repository:
git clone https://github.com/RedFox-Studios/brainfuck-runner.git
- Navigate to the project directory:
cd brainfuck-runner
- Install dependencies:
npm install
- Run a Brainfuck script:
npm start run <filename>
- List available scripts:
npm start list
- Run with debug mode:
npm start run <filename> -d
When running in debug mode (-d flag), you can use the following commands:
c
- Continue executions
- Enable step modeq
- Quit execution
Place your Brainfuck scripts in the /bf-scripts
directory. Here's a simple "Hello World" script example:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
You can add breakpoints to your scripts using the '#' character:
+++++ # Initialize counter
# # Breakpoint before loop
[>+.<-] # Print sequence
In debug mode, the tool provides a visual representation of the memory state:
Memory State:
0 0 [5] 0 0 0 0 0 0 0
After running a script, you'll see:
- Execution time
- Total iterations
- Final memory state (in debug mode)
All executions are logged in the /logs
directory:
error.log
- Error messagescombined.log
- All execution information
brainfuck-runner/
├── src/
│ ├── index.js # Main entry point
│ ├── interpreter.js # Brainfuck interpreter
│ ├── debug.js # Debug utilities
│ ├── logger.js # Logging configuration
│ └── commands.js # CLI commands
├── bf-scripts/ # Brainfuck scripts directory
└── logs/ # Execution logs
The runner includes several safety features:
- Maximum iteration limit (10 million)
- Infinite loop detection
- Memory bounds checking
- Error logging
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Original Brainfuck language by Urban Müller
- Node.js and npm community
- Contributors and users of this tool
If you encounter any issues or have questions, please:
- Check the existing issues
- Create a new issue with a detailed description
- Include relevant script samples and error messages
Made with ❤️ by Michal Flaška
P.S., (I almost died in the process)