Skip to content

Instantly share code, notes, and snippets.

@zeaga
zeaga / brainfuck_compiler.c
Created August 7, 2022 16:50
Simple brainfuck compiler in less than 100 lines of C
#include <stdio.h>
#include <stdlib.h>
char* read_file( char* file_name ) {
FILE* file = fopen( file_name, "r" );
if ( file == NULL ) {
printf( "Could not open input file `%s`.\n", file_name );
exit( 1 );
}
# Taken from https://github.com/ehmatthes/pcc/releases/download/v1.0.0/beginners_python_cheat_sheet_pcc_all.pdf
### TYPES
my_boolean = True
my_string = "Hello, world!"
my_integer = 10
my_long = 345L
my_float = 45.67
my_complex = 3.14J