obf

Description

An optimizing Brainfuck compiler in Pharo

Details

Source
GitHub
Dialect
pharo (25% confidence)
Stars
3
Created
Aug. 29, 2023
Updated
Oct. 8, 2025

Categories

Language Extensions

README excerpt

# obf

An optimizing compiler for Brainfuck in Pharo. Compiles to Pharo VM bytecode.
## Usage 
The easiest access to the compiler is done by accessing the (Glamorous Toolkit) views just by getting a live instance:
```
BrainfuckCompiler new
```

You can generate compiled code like this:
```smalltalk
"a regular compile"
BrainfuckCompiler new compile: '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.'.

"or enable optimizations"
BrainfuckCompiler new enableOptimizations compile: '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.'.

```

The resulting code can be executed using `valueWithReceiver: arguments:`. It doesn’t take any
arguments and the receiver does not matter, so I usually use `self valueWithReceiver: 1 arguments: #()`.
## Installation

```smalltalk
Metacello new
	repository: 'github://hellerve/obf:main/src';
	baseline: 'Brainfuck';
	load
```

<hr/>

Have fun!
← Back to results