You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
8 months ago | |
---|---|---|
.gitignore | 1 year ago | |
Makefile | 1 year ago | |
README | 1 year ago | |
TODO | 1 year ago | |
brainfuck.c | 8 months ago |
README
# Brainfuck Interpreter This interpreter will be able to take in basic tokens (e.g. `<`, `>`, etc. see below) and output data as per the spec. ## The Spec Commands are read from left to right, token by token, unless otherwise specified. There is an instruction pointer, a data pointer, and memory to work with, and they all can be modified by the commands below. ### Commands Token | Effect ----- | ------ > | Increment the data pointer < | Decrement the data pointer + | Increment the byte at the data pointer - | Decrement the byte at the data pointer . | Output the byte at the data pointer , | Accept one byte of input and store at data pointer [ | If byte at data pointer is zero, jump to command after matching ] ] | If byte at data pointer is not zero, jump to command after matching [ ### Other Notes This implementation is wrapping, meaning that the data bytes have an upper limit of 255 and a lower limit of 0. You can recompile with DEBUG set to 1 to get debug messages. ## Why Make This It's a rite of passage, and I'm looking forward to exercising more in C, as well as eventually getting into making languages myself, as well as learning more about Lisp, Forth, parsers in general, etc.