Kittle Buffer
1 Introduction
2 Extensions to the vanilla BF
3 How to obtain KBF
4 The builtin function-table
5 Changelog
6 Examples
8.13.0.9

Kittle Buffer🔗ℹ

1 Introduction🔗ℹ

Kittle Buffer, or KBF for short, is an extended Brainf**k implementation. KBF could also be explained as Killian’s Brainf**k.

This is a project I use to teach my kid, that’s why I renamed it to eliminate the dirty word.

This document doesn’t contain any introduction or manual of BF, but you must know what BF is before you use KBF. BF has only 8 instructions, it is a simple yet intresting programming language, you will easily find many materials for learning it if you do a search on the internet.

2 Extensions to the vanilla BF🔗ℹ

I added a few extensions to the vanilla BF with the intention of making it more expressive, more interesting, and richer for kid teaching.

Among these extensions, the most important ones are ^ and @.

^ is for multiple pointers support. A pointer stack is added besides the data cells (a.k.a, the data buffer), you can push into or pop out a pointer from the pointer stack. Each pointer has a integer ID. When a BF program starts, the default pointer whose ID is 0 is pushed into the pointer stack automatically. Afterwards, you can push a pointer into the pointer stack by ^ID where ID is the numerical ID of the pointer. If you want to pop the top pointer out from the pointer stack, just use ^ without any digit following it. As a special case, the last pointer in the pointer stack can’t be popped out: ^ does nothing when there’s only one pointer in the pointer stack.

The current pointer which instrcutions like +-<> are manipulating is always the top pointer of the pointer stack.

@ is added for function call. The vanilla BF has no function related facilities and it is hard to do calculations like comparison and division. To cope with this issue, I add a function table to KBF. Each function in that table has an integer ID, for example:

A function call is usually expressed as ret = func(args...) in common programming languages, so do we here:

Let’s see an example: ^0^1>+21^2>>+^3>>>++@2 calculates that cell(0) = cell(2) + cell(3), which is cell(0) = 1 + 2.

There are also some trivial extensions besides the two main extensions:

Here is a simple demonstration of the GUI window:

3 How to obtain KBF🔗ℹ

There are pre-built binaries hosted here:

Or you can download the source from github and run it from source:

4 The builtin function-table🔗ℹ

5 Changelog🔗ℹ

v0.2.1

v0.2

v0.1

6 Examples🔗ℹ

The below code:
^0^1>+21^2>>+50^3>3+47@2^0.

outputs a.