{"id":31737261,"url":"https://github.com/kyllingene/brim","last_synced_at":"2026-01-20T17:59:35.740Z","repository":{"id":194371385,"uuid":"690699746","full_name":"Kyllingene/brim","owner":"Kyllingene","description":"An optimizing brain* interpreter.","archived":false,"fork":false,"pushed_at":"2025-07-31T03:01:47.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-02T14:57:15.351Z","etag":null,"topics":["brainfuck","interpreter","optimized","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/Kyllingene.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,"zenodo":null}},"created_at":"2023-09-12T17:38:17.000Z","updated_at":"2025-07-31T03:01:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"51d4098b-b8b2-492f-8e28-162ecd06b20a","html_url":"https://github.com/Kyllingene/brim","commit_stats":null,"previous_names":["kyllingene/brim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kyllingene/brim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kyllingene%2Fbrim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kyllingene%2Fbrim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kyllingene%2Fbrim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kyllingene%2Fbrim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kyllingene","download_url":"https://codeload.github.com/Kyllingene/brim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kyllingene%2Fbrim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001135,"owners_count":26083021,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","interpreter","optimized","rust"],"created_at":"2025-10-09T09:08:41.770Z","updated_at":"2025-10-09T09:11:38.658Z","avatar_url":"https://github.com/Kyllingene.png","language":"Rust","readme":"# Brim\n\n![build status](https://github.com/kyllingene/brim/actions/workflows/rust.yml/badge.svg)\n![license](https://img.shields.io/crates/l/brim)\n![version](https://img.shields.io/crates/v/brim)\n\nBrim is an optimizing brain* interpreter than nonetheless strives to be very\npleasant and easy to use.\n\n## Features\n\n### Details\n\nBrim supports two types of tape: 30000-long wrapping, or non-wrapping\ndynamic-width. The former is default; the latter is through feature\n`dynamic_array`.\n\nThe cells themselves have three features you can customize: wrapping, width, and\nsignedness. By default, cells are unsigned bytes that wrap. However, through\ncombining the following features, you can achieve multiple different kinds of\ncell:\n    - `nowrap`: Disables wrapping on increment/decrement\n    - `wide_cell`: Changes cells to be 64-bit\n    - `signed_cell`: Changes cells to be signed\n\n### Debug\n\nIf compiled in debug mode, or with the feature flag `debug`, brim will\nrecognize the character `;`. This will dump several relevant bits of info\n(the tape, the tape pointer, and three instructions for context) to\nthe supplied output.\n\n### File I/O\n\nWith the `-i | --input` and `-o | --output` flags, brim can read/write to/from\nfiles instead of stdin/stdout.\n\nRegardless of source or destination, all I/O is buffered to provide a fast and\nreliable experience (the output is flushed on each newline, and upon exit).\n\n### Optimizations\n\nBrim internally uses a token-based intermediary structure to execute the code.\nFirst, it groups together add, subtract, left, and right instructions to\neliminate repetitive cycles (as well as discard redundant instructions).\n\nThen, it performs several macro-optimizations to reduce common operations to\na single \"instruction\". Currently, it recognizes:\n\n- Zeroing a cell (`[-]`)\n- Setting a cell to a value (`[-]++++`)\n- Moving one cell to another (`[-\u003e+\u003c]` / `[\u003e+\u003c-]`)\n    - Also recognizes multiplication (`[-\u003e+++\u003c]`)\n- Subtracting one cell from another (`[-\u003e-\u003c]`)\n- Scanning for a zero cell (`[\u003e\u003e\u003e]`)\n- Duplicating a cell (`[-\u003e+\u003e+\u003c\u003c]`)\n    - Also recognizes multiplication (as with moving)\n\nThe token-based structure makes these trivial to recognize, since repeating\ninstructions have already been collapsed into one.\n\nFinally, it iterates over each bracket (`[`/`]`) and pre-loads its destination,\nso executing them requires zero lookup time (it just overrides the IP).\n\nThese are all run in a buffered I/O environment, as detailed above.\n\n### Importing\n\nThis crate is also available as a library. The executable simply provides a CLI\ninterface to the library. The points of interest are the `parse` and `optimize`\nfunctions, as well as the `Token` enum.\n\n## Roadmap\n\nBrim isn't finished yet! My hopes for the future include:\n\n- More macro-optimizations\n- Tape customizations via features\n- Cell behavior variants via features\n\n## Contributions\n\nContributions are always welcome, especially optimizations. Please, before you\ncreate a pull request, run `cargo fmt` and `cargo clippy`.\n\nIf you want to implement a new feature, consider gating it behind a feature\nflag. This can reduce code size as well as slightly improve runtimes. It isn't\nappropriate for all additions, but it is worth considering.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyllingene%2Fbrim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyllingene%2Fbrim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyllingene%2Fbrim/lists"}