Crates.io | sateko |
lib.rs | sateko |
version | 0.1.0 |
source | src |
created_at | 2021-09-09 03:31:35.345644 |
updated_at | 2021-09-09 03:31:35.345644 |
description | A toy brainfuck compiler |
homepage | https://github.com/scowcron/sateko |
repository | https://github.com/scowcron/sateko |
max_upload_size | |
id | 448694 |
size | 42,144 |
sateko is a toy brainfuck compiler.
NOTE: this requires LLVM 12 installed on your machine.
sateko compiles a bf script (e.g. hello.bf) into LLVM IR. The typical process of building an executable depends on your development environment. Building a typical bf program might look something like this:
$ sateko hello.bf
$ llc out.ll
$ gcc out.s
$ ./a.out
Brainfuck is an esoteric programming language that models a Turing machine. While the language itself is very simple, being productive with it is often less so.
Conceptually, the runtime environment (in this case sateko) provides a tape consisting of byte-sized cells and a set of operations which manipulate that tape.
Each time a loop starts, the interpreter will check the value on tape at the current position. If that value is 0, the loop will terminate, otherwise, all operations contained between [ and ] will be executed.
This is a toy project. I wanted to play with Rust and do a bit of parsing. The brainfuck language is extremely simple to parse, and the number of concerns in the execution envronment is very small.
And, there's a lot of room for experimentation.
Some ideas:
sateko uses the 3-clause BSD license. See LICENSE file.