An open API service indexing awesome lists of open source software.

https://github.com/refi64/b.k

A BF interpreter written in K
https://github.com/refi64/b.k

Last synced: 5 months ago
JSON representation

A BF interpreter written in K

Awesome Lists containing this project

README

          

b.k
===

A Brainf*** interpreter written in K. You know, the language that goes like this::

+ increment value at tape pointer
- decrement value at tape pointer
< decrement tape pointer
> increment tape pointer
[ jump to the matching right bracket is the value at the tape pointer is 0
] jump to the matching left bracket is the value at the tape pointer is not 0
. print the value at the tape pointer
, read a character from the screen

This interpreter is by no means fast...but it works. Pretty well, too, except that I didn't implement the ``,`` character because, as far as I know, reading a single character isn't possible with K2 unless you resort to C extensions. This is written for `Kona `_ and K2, NOT kdb+ 3. It will NOT run under kdb+ 3 (if you figure out how without using q, let me know!).

The whole thing is (without comments and blank lines) 378 characters (358 if you remove unnecessary newlines).