{"id":18550887,"url":"https://github.com/mrjameshamilton/bf-llvm","last_synced_at":"2026-05-03T05:40:03.522Z","repository":{"id":197565907,"uuid":"693335780","full_name":"mrjameshamilton/bf-llvm","owner":"mrjameshamilton","description":"A LLVM brainf*ck compiler","archived":false,"fork":false,"pushed_at":"2024-01-17T20:52:06.000Z","size":46,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T10:27:50.700Z","etag":null,"topics":["brainfuck","brainfuck-compiler","compiler","llvm"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrjameshamilton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-09-18T20:29:16.000Z","updated_at":"2024-09-14T18:24:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"f66072d9-f7ce-4693-8f80-279dcc433ef3","html_url":"https://github.com/mrjameshamilton/bf-llvm","commit_stats":null,"previous_names":["mrjameshamilton/bf-llvm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fbf-llvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fbf-llvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fbf-llvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fbf-llvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrjameshamilton","download_url":"https://codeload.github.com/mrjameshamilton/bf-llvm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319720,"owners_count":22051075,"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":["brainfuck","brainfuck-compiler","compiler","llvm"],"created_at":"2024-11-06T21:06:00.365Z","updated_at":"2026-05-03T05:40:03.455Z","avatar_url":"https://github.com/mrjameshamilton.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An optimizing LLVM Brainf*ck compiler\n\nAn optimizing [brainf*ck](http://brainfuck.org/brainfuck.html) compiler using LLVM.\n\nSome optimizations are applied before code generation:\n\n* Zero-ing loops (`[+]` / `[-]`) are represented as a single instruction\n* Consecutive move and add instructions are merged into single instructions with\nan amount parameter\n\nThen LLVM optimizations are applied on the generated LLVM IR. As an example of these\npowerful optimizations, brainf*ck HelloWorld will be optimized to simple `putchar` calls:\n\n```llvm\n// Input\n\u003e++++++++[\u003c+++++++++\u003e-]\u003c.\u003e++++[\u003c+++++++\u003e-]\u003c+.+++++++..+++.\n\u003e\u003e++++++[\u003c+++++++\u003e-]\u003c++.------------.\u003e++++++[\u003c+++++++++\u003e-]\n\u003c+.\u003c.+++.------.--------.\u003e\u003e\u003e++++[\u003c++++++++\u003e-]\u003c+.\n\n// Optimized IR output\ndefine i32 @main() local_unnamed_addr #0 {\nentry:\n  %0 = tail call i32 @putchar(i32 72)\n  %1 = tail call i32 @putchar(i32 101)\n  %2 = tail call i32 @putchar(i32 108)\n  %3 = tail call i32 @putchar(i32 108)\n  %4 = tail call i32 @putchar(i32 111)\n  %5 = tail call i32 @putchar(i32 44)\n  %6 = tail call i32 @putchar(i32 32)\n  %7 = tail call i32 @putchar(i32 87)\n  %8 = tail call i32 @putchar(i32 111)\n  %9 = tail call i32 @putchar(i32 114)\n  %10 = tail call i32 @putchar(i32 108)\n  %11 = tail call i32 @putchar(i32 100)\n  %12 = tail call i32 @putchar(i32 33)\n  ret i32 0\n}\n```\n\n## Building and Executing\n\n```shell\n$ cmake -G Ninja -B build\n$ ninja -C build\n$ build/bf examples/helloworld.bf -o build/helloworld.ll\n$ lli build/helloworld.ll\n```\n\n## Other targets\n\nThis project is a port of [bf](https://github.com/mrjameshamilton/bf) which is a brainf*ck compiler with backends for:\n\n* JVM\n* Smali\n* Dex\n* C\n* LLVM IR\n* ARM assembly\n* WASM\n* JavaScript\n* Lox\n\n# Useful brainf*ck resources\n\n* [Brainf*ck language reference](http://brainfuck.org/brainfuck.html)\n* [Sample programs by Daniel B Cristofani](http://brainfuck.org/)\n* [Optimizing brainf*ck programs](http://calmerthanyouare.org/2015/01/07/optimizing-brainfuck.html)\n* [Brainf*ck Wikipedia article](https://en.wikipedia.org/wiki/Brainfuck)\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjameshamilton%2Fbf-llvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrjameshamilton%2Fbf-llvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjameshamilton%2Fbf-llvm/lists"}