Skip to content

An interpreter for the Bitter esoteric programming language written in C.

License

Notifications You must be signed in to change notification settings

ragibasif/bitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitter Interpreter in C

A C implementation of the Bitter esoteric programming language - a minimalist Brainfuck variant that operates on single-bit memory cells. Project built for educational and recreational purposes.

"Like Brainfuck - only much, much worse." - User:DMC, creator of Bitter

Hello, World

The following Bitter source code outputs "Hello, World!\n" to stdout:

Hello, World!\n

Bitter REPL Demo 00

About Bitter

Bitter is a Turing-complete esoteric programming language created by User:DMC that operates on single-bit memory cells.

Key features:

  • 1-bit memory cells
  • Only 4 core commands: <, >, (, )
  • 2 interpreter commands: !, #
  • Infinite, unbounded memory tape (positive direction only)
  • Memory initialized to 0

Language Commands

Command Description
> Move pointer right by 1 and invert the bit
< Move pointer left by 1 and invert the bit
( If current bit is 1, continue; else jump past matching )
) Jump back to matching (
! (Debug) Dump memory from 0 to highest data pointer reached
# (Debug) Pause execution and dump memory

increment and invert

decrement and invert

Installation

  1. Clone this repository:

    git clone https://github.com/ragibasif/bitter.git
    cd bitter
  2. Run make

    make all

Usage

REPL

Run the following in the command line to start the REPL:

./bitter

To exit out of the REPL, enter the following:

:quit

Source File

Run the ./bitter command with the <filename>.bitr as the argument:

./bitter <filename>.bitr

Examples

examples/
├── 00_hello_world.bitr -> Load memory 0 through 111 with 'Hello, World!\n'
├── 01_truth_machine_0.bitr -> initialize data[0] = 0 and end on data[1] = 0
└── 02_truth_machine_1.bitr -> infinite loop: fill memory with 1 and dump memory

Example of evaluating the truth machine from the REPL:

REPL Truth Machine

Example of evaluating the truth machine from a source file:

Source File Truth Machine

Example of evaluating the infinite loop truth machine from a source file:

Source File Infinite Loop Truth Machine

Acknowledgements