38 lines
973 B
Markdown
38 lines
973 B
Markdown
# Brainfuck interpreter & compiler
|
|
|
|
https://en.wikipedia.org/wiki/Brainfuck
|
|
|
|
## Building & Usage
|
|
|
|
To compile CLI
|
|
```shell
|
|
zig build -Doptimize=ReleaseFast
|
|
```
|
|
|
|
Will run using emulator
|
|
```shell
|
|
./zig-out/bin/brainfuck run <filename>
|
|
```
|
|
|
|
Will compile program to executable
|
|
```shell
|
|
./zig-out/bin/brainfuck compile <filename> <output>
|
|
```
|
|
|
|
## Developing
|
|
|
|
This command will create a `compile_commands.json` file which an IDE can use to more smartly say from where
|
|
each file is included. If you don't do this, some defines not be defined and then what you see in the IDE
|
|
wont match what the compiler is doing.
|
|
```
|
|
zig build cdb
|
|
```
|
|
|
|
## Feature wishlist
|
|
|
|
* Update TinyCC backend, so host would not need to have it installed. Relies on host having include paths used by TinyCC.
|
|
* Add more backends. Maybe LLVM, nasm or create my own
|
|
* Perform optimizations? Like removing not needed `[]` blocks which are known never to be ran? Idk, what could be optimized
|
|
* Add WASM/Web build
|
|
|