Skip to content

znschaffer/bcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainf*ck Compiler (bcc)

This repository contains a simple Brainf*ck compiler written in C. The compiler reads a Brainf*ck source file, executes it, and outputs the result.

Features

  • Dynamic Memory Management: The memory used for data and instructions can dynamically resize based on the program's needs.
  • Jump List Building: Efficiently handles [ and ] loops by precomputing the jump positions.
  • Debug Mode: Provides debug output to help trace the execution (if compiled with DEBUG mode).

Compilation

To compile the program, use the following command:

gcc -o bcc bcc.c

Debug Mode

If you want to enable debug mode, compile with the DEBUG flag:

gcc -o bcc -DDEBUG bcc.c

In debug mode, the program will print each instruction and its corresponding state (instruction pointer, data pointer, and current data value).

Usage

To run the Brainf*ck compiler, provide the path to a .bf file as a command-line argument:

./bcc filename.bf

Future Improvements

Add better error handling and reporting for invalid Brainf*ck syntax. Improve memory management efficiency. Expand the debug output to include more detailed trace information.

About

BrainF*** Interpreter in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages