{"id":20196080,"url":"https://github.com/thehxdev/bfi","last_synced_at":"2025-08-22T10:35:31.214Z","repository":{"id":219635031,"uuid":"749510012","full_name":"thehxdev/bfi","owner":"thehxdev","description":"Fast and efficient BrainFuck compiler and interpreter written in C","archived":false,"fork":false,"pushed_at":"2024-04-05T19:25:41.000Z","size":94,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-05T20:31:32.432Z","etag":null,"topics":["assembly","brainfuck","brainfuck-compiler","brainfuck-interpreter","c","compiler","interpreter","nix"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thehxdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-28T19:30:31.000Z","updated_at":"2024-04-14T21:39:37.605Z","dependencies_parsed_at":"2024-02-09T19:29:26.330Z","dependency_job_id":"7e59de3b-f9ae-47aa-92fa-8bb39cec1dea","html_url":"https://github.com/thehxdev/bfi","commit_stats":null,"previous_names":["thehxdev/bfi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Fbfi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Fbfi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Fbfi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Fbfi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thehxdev","download_url":"https://codeload.github.com/thehxdev/bfi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199080,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","brainfuck","brainfuck-compiler","brainfuck-interpreter","c","compiler","interpreter","nix"],"created_at":"2024-11-14T04:21:35.148Z","updated_at":"2025-04-10T10:23:24.795Z","avatar_url":"https://github.com/thehxdev.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BFI\n\nBFI is a fast and efficient BrainFuck interpreter and compiler written in C (C99).\n\nFor more information about BrainFuck read the [BrainFuck wikipedia page](https://en.wikipedia.org/wiki/Brainfuck).\n\nYou can find more complex and interesting examples in [brainfuck.org](https://brainfuck.org) website.\ndownload `*.b` source files and execute them with BFI.\n\n\n\n## Build\nFirst clone the source code using git.\n```bash\ngit clone --depth=1 --branch=main https://github.com/thehxdev/bfi\n\ncd bfi\n```\n\nMake sure that you have a C compiler like `gcc` or `clang` and `make` installed.\n\n### make build options:\n- `OPTIMIZE`: \nTo compile with debug information, set `OPTIMIZE` to 0.\n\n- `SAFE`: \nTo add memory access protections set `SAFE` to 1.\nThis makes bfi (a little) slower but out of range accesses to memory while executing BrainFuck source code will be catched.\n(This only affects the interpreter and NOT the compiler!)\n\n- `STATIC`:\nSet `STATIC` option to 1 to build bfi as a standalone, staticly linked binary using [musl libc](https://musl.libc.org/).\nBut befor that, make sure that you have `musl-clang` and musl libc installed.\n\n\n### Build bfi\nBuild bfi using the folloing command:\n```bash\nmake OPTIMIZE=1\n```\nThen you can use `bfi` executable in `build/` directory.\n\n\n\n## Usage\nYou can use `bfi` as an interpreter or a compiler.\n\n\n### Interpreter\n\nAfter you built `bfi`, You can run examples provided in `examples` directory. Just execute `bfi` and provide\nthe source code file as first command-line arugment.\nwhile you are in the project root directory:\n```bash\n# run `examples/helloWorld.bf` file\n# this will print `Hello World!` to stdout\n./build/bfi 'examples/helloWorld.bf'\n```\n\n### Compiler\n\nTo compile BrainFuck source code to **x64 Assembly** (AT\u0026T Syntax), provide source code file as first argument\nand output file as second argument.\nThen you can use `gcc` to build the executable from generated assembly file.\n```bash\n# compile `examples/helloWorld.bf` file to `helloWorld.S`\n./build/bfi 'examples/helloWorld.bf' './helloWorld.S'\n\n# assemble `helloWorld.S` file\ngcc './helloWorld.S'\n```\n\n## More Info\n\nbfi ignores all characters that are not a valid BrainFuck command. BrainFuck has only 8 commands:\n\n- `\u003e` : increment data pointer by one\n- `\u003c` : decrement data pointer by one\n- `+` : increment byte at the data pointer by one\n- `-` : decrement byte at the data pointer by one\n- `.` : output the data at data pointer (print to stdout as single character)\n- `,` : accept one character from stdin and store it in data pointer\n- `[` : jump to next command of matching `]`, if the data pointer's data is zero\n- `]` : jump to next command of matching `[` (goes backward), if the data pointer's data is non-zero\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthehxdev%2Fbfi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthehxdev%2Fbfi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthehxdev%2Fbfi/lists"}