https://github.com/ugnmura/bf-transpiler
Simple brainf**k transpiler written in C.
https://github.com/ugnmura/bf-transpiler
brainfuck c cmake compiler transpiler
Last synced: about 1 year ago
JSON representation
Simple brainf**k transpiler written in C.
- Host: GitHub
- URL: https://github.com/ugnmura/bf-transpiler
- Owner: ugnmura
- License: mit
- Created: 2022-03-07T20:00:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-10T12:33:44.000Z (about 4 years ago)
- Last Synced: 2025-02-15T02:35:35.574Z (over 1 year ago)
- Topics: brainfuck, c, cmake, compiler, transpiler
- Language: C
- Homepage:
- Size: 35.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Brainf**k Transpiler
Simple brainf**k transpiler written in C.
## Getting Started
Clone the repo
```bash
git clone https://github.com/SushiWaUmai/bf-transpiler.git
```
Generate the project using CMake
```bash
mkdir build && cd build
cmake ..
```
## Usage
Here is a simple example how to print the string "Hello, World!"
```C
#include "bf.h"
int main(void)
{
// Create the output stream
FILE *bf_output = fopen("output.bf", "w");
// Initialize the brainf**k transpiler
bf_t *bf = bf_init(bf_output);
// Open a scope in the stack memory
bf_open_scope(bf);
{
// allocate a buffer for the string and populate the buffer with "Hello, World!\n"
bf_ptr_t hello_world_ptr = bf_create_buffer(bf, "Hello, World!\n", 14);
bf_print_ascii_buffer_l(bf, hello_world_ptr, 14);
}
// Close the scope in the stack memory and free the memory
bf_close_scope(bf);
// Close the output stream
fclose(bf_output);
// Free the brainf**k transpiler
bf_terminate(bf);
}
```
This code will generate a file named `output.bf` that will print the string `"Hello, World!"` in the brainf**k language.