{"id":18551780,"url":"https://github.com/tomhea/bf2fj","last_synced_at":"2025-11-01T09:30:27.756Z","repository":{"id":177454960,"uuid":"658903093","full_name":"tomhea/bf2fj","owner":"tomhea","description":"A Brainfuck to FlipJump compiler","archived":false,"fork":false,"pushed_at":"2025-01-11T10:30:26.000Z","size":521,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T11:35:33.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Brainfuck","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomhea.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-26T18:21:54.000Z","updated_at":"2025-01-11T10:30:31.000Z","dependencies_parsed_at":"2024-11-06T21:10:26.211Z","dependency_job_id":"4bd73ba4-0322-4a9e-ba18-0473463a12cb","html_url":"https://github.com/tomhea/bf2fj","commit_stats":null,"previous_names":["tomhea/bf2fj"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Fbf2fj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Fbf2fj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Fbf2fj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Fbf2fj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomhea","download_url":"https://codeload.github.com/tomhea/bf2fj/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239278506,"owners_count":19612329,"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":[],"created_at":"2024-11-06T21:10:19.917Z","updated_at":"2025-11-01T09:30:27.723Z","avatar_url":"https://github.com/tomhea.png","language":"Brainfuck","funding_links":[],"categories":["Full table"],"sub_categories":[],"readme":"[![GitHub](https://img.shields.io/github/license/tomhea/bf2fj)](LICENSE)\n[![Website](https://img.shields.io/website?down_color=red\u0026down_message=down\u0026up_message=up\u0026url=https%3A%2F%2Fesolangs.org%2Fwiki%2FFlipJump)](https://esolangs.org/wiki/FlipJump)\n[![PyPI - Version](https://img.shields.io/pypi/v/bf2fj)](https://pypi.org/project/bf2fj/)\n\n# bf2fj\nA [Brainfuck](https://esolangs.org/wiki/Brainfuck) to [FlipJump](https://github.com/tomhea/flip-jump) Compiler.\n\nThe compiler was built to be very fast. Moreover, the flipjump programs generated by this project are generated in a way that will keep them very small, thus their compilation into an .fjm file is also fast. \n\nSee also the [C to FlipJump Compiler](https://github.com/tomhea/c2fj).\n\n## Download:\n```\n\u003e\u003e\u003e pip install bf2fj\n```\n\n## Run the compiler:\n\n```\n\u003e\u003e\u003e bf2fj hello_world.bf \n  compile bf-\u003efj:  0.008s\n```\n\nYou can also run the created flipjump program.\n```\n\u003e\u003e\u003e bf2fj hello_world.bf -r\n  compile bf-\u003efj:  0.008s\n  parsing:         0.092s\n  macro resolve:   0.141s\n  labels resolve:  0.035s\n  create binary:   0.143s\n  loading memory:  0.017s\nHello World!\n\nFinished by looping after 0.739s (337,484 ops executed; 85.36% flips, 98.88% jumps).\n```\n\nNote that you can modify the number of brainfuck cells that'll be reserved in the flipjump file, with `-c` / `--cells`.\n\n## Optimizations\nThis compiler supports optimizations of the generated flipjump code.  \n\nThe optimizations are significant. It lowered the hello_world.bf program from 2,900,990 fj ops to 337,484 fj ops (88% faster).\n\nThe major optimizations strategies:\n- Optimize multiple data ops: `+++++` =\u003e `+5`, and `----++-` =\u003e `-3`.\n- Optimize multiple pointer ops: `\u003e\u003e\u003e\u003e\u003e` =\u003e `\u003e5`, `\u003c\u003c\u003c\u003c\u003e\u003e\u003c` =\u003e `\u003c3`.\n- Find zeroing loops, and replace them with `*ptr = 0`. If there are data-ops before it, removes them too.\n- `*ptr = 0` + `+5` =\u003e `*ptr = 5`.\n\n## Tests:\nI've gathered many brainfuck programs, and put them all inside the programs/ folder.  \nThe tests compile each of them to flipjump:\n```\n\u003e\u003e pytest --compile-only\n```\nYou can also run the compiled flipjump files (just omit the `--compile-only` flag), but I only added the input / expected-output files to only a portion of the tests, so it won't pass.\n\n## Licenses:\nThe programs/ folder has a collection of 3rd party brainfuck programs, taken from multiple open-source websites. Each folder under programs/ has a README.md that specifies were the brainfuck files came from, and to whom we owe the credit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhea%2Fbf2fj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomhea%2Fbf2fj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhea%2Fbf2fj/lists"}