Skip to content

shinbatsu/bf-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compiler

This project is a Brainfuck compiler written mostly in assembly, capable of parsing Brainfuck code and printing its output to standard output or to file.

Brainfuck (often stylized as BF) is an extremely small yet Turing-complete PL.

You can find brainfuck wiki right here.

Struture

The compler reads and executes Brainfuck code directly from a file.

  • Input file: code.bf — contains your Brainfuck program.
  • Optional input: input.txt — contains input characters to be read by the Brainfuck , command.
  • Output file: output.txt — the result of program execution is written here.
    • If output.txt already exists, it will be overwritten.
    • If the program requests input but input.txt is missing, execution will fail with an error.

How to use it

  1. Put your Brainfuck program in a file named code.bf.
  2. Add input data in input.txt it your code requires it.
  3. Run the compiler main.exe.

Files:

  • code.bf - brainfuck source code
  • input.txt - some input args
  • output.txt - some output artifacts

Quickdraw

Command Symbol Description
Increment Pointer > Move the memory pointer to the right (next cell).
Decrement Pointer < Move the memory pointer to the left (previous cell).
Increment Byte + Increase the byte value at the current cell by 1.
Decrement Byte - Decrease the byte value at the current cell by 1.
Output Byte . Print the character corresponding to the byte at the current cell.
Input Byte , Read one character from input and store it in the current cell.
Loop Start [ If the current cell value is 0, jump forward to the command after the matching ].
Loop End ] If the current cell value is nonzero, jump back to the command after the matching [.

Remarks

  • The compiler is primarily written in assembly, emphasizing performance and low-level control. But the main purpose it just make some fun during a development process.

  • Designed for educational and experimental use.

About

Assembly implementation of .bf language. Well known esoteric programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published