{"id":25418870,"url":"https://github.com/lukad/rbf","last_synced_at":"2025-05-06T14:42:43.293Z","repository":{"id":147431490,"uuid":"106593224","full_name":"lukad/rbf","owner":"lukad","description":"⚙️ A fast, optimizing JIT interpreter for brainfuck","archived":false,"fork":false,"pushed_at":"2023-02-28T20:34:14.000Z","size":46,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-01T22:38:33.406Z","etag":null,"topics":["brainfuck","dynasm","jit","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/lukad.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,"publiccode":null,"codemeta":null}},"created_at":"2017-10-11T18:27:09.000Z","updated_at":"2022-08-01T16:11:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b18e5d3-1433-4002-b927-e521a72cdf01","html_url":"https://github.com/lukad/rbf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukad%2Frbf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukad%2Frbf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukad%2Frbf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukad%2Frbf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukad","download_url":"https://codeload.github.com/lukad/rbf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252705601,"owners_count":21791283,"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","dynasm","jit","rust"],"created_at":"2025-02-16T18:28:23.301Z","updated_at":"2025-05-06T14:42:43.288Z","avatar_url":"https://github.com/lukad.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rbf\n\nA JIT compiling brainfuck interpreter written in rust. It's fast!\n\nThe interpreter is split into two crates using a workspace:\n\n* `rbf`: The executable that let's you run brainfuck code\n* `librbf`: This is where all the interpreter code is implemented\n\nThe way this interpreter works is:\n\n1. Parse code into an intermediate representation\n2. Apply some optimizations\n3. Generate code using [dynasm-rs](https://github.com/CensoredUsername/dynasm-rs)\n4. Run the generated code\n\n## Installation\n\nThis project requires rust 1.45.0 or newer.\n\n### Using `cargo install`\n\n``` bash\n$ cargo install https://github.com/lukad/rbf.git\n```\n\n### Compiling manually with cargo\n\n``` bash\n$ git clone https://github.com/lukad/rbf.git\n$ cd rbf\n$ cargo install\n```\n\n## Library usage\n\nAdd `librbf` to your depedencies in the `Cargo.toml`.\n\n``` toml\n[dependencies]\nlibrbf = { git = \"https://github.com/lukad/rbf.git\" }\n```\n\nUse it in your code.\n\n``` rust\nuse librbf::{parse, Jit};\n\nfn main() {\n    let source = \"++++++++[\u003e++++++++\u003c-]\u003e.\".as_bytes();\n    let program = parse(source);\n    let fun = Jit::new().compile(\u0026program);\n    fun.run();\n}\n```\n\n## Optimizations\n\nThe following optimizations are implemented:\n\n* Fusing of adjacent `+` and `-` instructions:  \n  `+-++-+` becomes `Add(2)`\n* Fusing of adjacent `\u003e` and `\u003c` instructions:  \n  `\u003e\u003e\u003c\u003c\u003c\u003c\u003e` becomes `Move(-1)`\n* Detection of set loops:  \n  `[-]` becomes `Set(0)`\n* Set instructions will be fused with following `Add` instructions:  \n  `[-]+++` becomes `Set(3)`\n* Detection of multiplication loops:  \n  `[\u003e++++\u003c-]` becomes `Mul(1, 8), Set(0)`\n* Detection of scan looops:  \n  `[\u003e\u003e]` becomes `Scan(2)`\n* Elimination of code without effects\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukad%2Frbf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukad%2Frbf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukad%2Frbf/lists"}