012345678910111213141516171819202122232425262728293031323334353637383940
|
# OBFI
A minimal and performant Brainfuck interpreter.
## Implementation Details
* OBFI uses single octet cells, and arithmetic wraps around.
* OBFI provides 30000 cells (configurable via `-l`).
* OBFI does not perform array bound checking.
* OBFI will set the current cell to 0 when EOF is encountered.
## Optimisations
* Compress `>` and `<` instructions.
* Compress `+` and `-` instructions.
* Replace `[+]` and `[-]` with a 'set to zero' instruction.
* Replace `[>]` and `[<]` with a 'go to zero' instruction.
* Replace `[+>+>]` and `[>+>+]` with a 'move to' instruction.
* Replace `[-<-<]` and `[<-<-]` with a 'move to' instruction.
## Usage
To build **OBFI**, from the project root, run `make build`.
See `./bin/obfi --help` for program options.
## Performance
On a machine with an Intel i7 12700K (20 cores @ 4.90 GHz) and 64 GB of
DDR4-4800 RAM, the `./examples/mandel.b` example was able to be run in an
average time of `1.945` seconds, compiled as specified above.
For comparison, the [SBFI](https://github.com/rinoldm/sbfi) interpreter, on the
same machine, with the same example program, was able to run in an average time
of `1.245` seconds, compiled with its recommended compilation command.
## Meta
Copyright (C) 2020, Jakob Wakeling
[MIT Licence](https://opensource.org/licenses/MIT)
|