{"id":25930387,"url":"https://github.com/mdlc01/brainzen","last_synced_at":"2026-05-13T03:01:52.459Z","repository":{"id":43807066,"uuid":"495465951","full_name":"MDLC01/brainzen","owner":"MDLC01","description":"A programming language that compiles to Brainfuck. It has a C-like syntax and lets you perform arithmetic with 8-bit integers.","archived":false,"fork":false,"pushed_at":"2023-09-11T14:14:03.000Z","size":763,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-09-11T20:07:46.051Z","etag":null,"topics":["brainfuck","brainzen"],"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/MDLC01.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}},"created_at":"2022-05-23T15:22:00.000Z","updated_at":"2023-07-18T10:58:01.000Z","dependencies_parsed_at":"2023-01-29T03:01:12.542Z","dependency_job_id":null,"html_url":"https://github.com/MDLC01/brainzen","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDLC01%2Fbrainzen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDLC01%2Fbrainzen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDLC01%2Fbrainzen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDLC01%2Fbrainzen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MDLC01","download_url":"https://codeload.github.com/MDLC01/brainzen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241753170,"owners_count":20014251,"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","brainzen"],"created_at":"2025-03-03T23:01:55.408Z","updated_at":"2025-12-03T06:10:11.511Z","avatar_url":"https://github.com/MDLC01.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"assets/icon.svg\" alt=\"Brainzen icon: a brain over a blue background\" width=\"128\" align=\"right\"\u003e\n\n# Brainzen\n\n**Brainzen** is a programming language that compiles to Brainfuck. It has a C-like syntax and lets you perform arithmetic with 8-bit integers.\n\n## About Brainfuck\n\nBrainfuck is an extremely basic programming language created by Urban Müller in 1993. A Brainfuck program consists of a string of characters each representing a command (or a comment). For the list of available commands, see [the Wikipedia article on Brainfuck](https://en.wikipedia.org/wiki/Brainfuck#Commands). Unlike most languages, there is no official specification for Brainfuck. This means behavior may vary slightly between interpreters. Brainzen uses the original interpreter as the definition of Brainfuck, with the exception that the array is expected to be infinitely expandable to the right (which allows for [Turing-completeness](https://en.wikipedia.org/wiki/Turing_completeness)), although it is not required that the pointer is able to access cells to the left of its starting position. It is also important to note (although this is the behavior of the original interpreter) that numbers are expected to be 8-bit integers, and overflows should result in a wrap around.\n\n## Brainzen\n\n### Specification\n\nBrainzen does not have an official specification yet. The current focus is on language design and the underlying implementation of more complex features. The syntax is therefore constantly evolving, with no guarantee of backward compatibility.\n\n### Features\n\nHere is a non-exhaustive list of major available features:\n\n- Subroutines;\n- Loops;\n- Conditional statements;\n- A strict type system with characters, [product types](https://en.wikipedia.org/wiki/Product_type) and type aliases;\n- Namespaces.\n\n### Considered features\n\nHere is a list of considered features in arbitrary order (this list is *not* commitment, merely an indication of where the language is heading):\n\n- Strings of arbitrary length;\n- Arrays;\n- Referencing subroutines before their respective declaration (including recursion);\n- In the long run, bigger integers (32-bit, 64-bit);\n- In the very long run, floating point numbers ([IEEE 754](https://en.wikipedia.org/wiki/IEEE_754)).\n\n### Turing-completeness\n\nIn its current state, Brainzen is *not* Turing-complete. Indeed, any given Brainzen program is a [finite-state machine](https://en.wikipedia.org/wiki/Finite-state_machine) (with a standard output).\n\n#### Proof\n\nFor any given Brainzen program, the amount of cells the resulting Brainfuck program uses is bounded. This is because the size of all variables is known at compile time, and every possible execution flow is hard coded (meaning recursion is not possible), so the compiler knows the exact size (and layout) of the memory at any point in the program.\n\n### Code examples\n\nThis section contains examples of basic programs and subroutines written in Brainzen. More complex examples are available in this repository, under the [`examples/`](examples) directory.\n\n#### Hello world\n\n```brainzen\nfunc main() {\n    println(\"Hello, World!\");\n}\n```\n\n#### Print numbers in base 10\n\nThe following procedure prints the passed number in base 10.\n\n```brainzen\nfunc print10(n: char) {\n    let d2 = n / 100;\n    let d1 = (n / 10) % 10;\n    let d0 = n % 10;\n    if (d2) {\n        print('0' + d2);\n    }\n    if (d1 || d2) {\n        print('0' + d1);\n    }\n    print('0' + d0);\n}\n```\n\nNote that the native `log` procedure does exactly that when passed a `char`.\n\n#### Truth machine\n\nThe following Brainzen program implements a [truth machine](https://esolangs.org/wiki/Truth-machine).\n\n```braiznen\nfunc main() {\n    let i = input();\n    if (i == '0') {\n        print('0');\n    } else {\n        while (1) {\n            print(i);\n        }\n    }\n}\n```\n\n#### Fibonacci\n\nThe following function computes the `n`th number of the [Fibonacci sequence](https://en.wikipedia.org/wiki/Fibonacci_number) iteratively.\n\n```brainzen\nfunc fibonacci(n: char) -\u003e char {\n    let a = 0;\n    let b = 1;\n    loop (n) {\n        let c = a + b;\n        a = b;\n        b = c;\n    }\n    return b;\n}\n```\n\n#### [Fizz Buzz](https://en.wikipedia.org/wiki/Fizz_buzz)\n\n```brainzen\nfunc fizzbuzz(n: char) {\n    let i = 1;\n    loop (n) {\n        if (i % 3 == 0 \u0026\u0026 i % 5 == 0) {\n            println(\"FizzBuzz\");\n        } else if (i % 3 == 0) {\n            println(\"Fizz\");\n        } else if (i % 5 == 0) {\n            println(\"Buzz\");\n        } else {\n            log(i);\n        }\n        i++;\n    }\n}\n```\n\n## Attributions\n\nThe brain on the icon is from [Twemoji](https://twemoji.twitter.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdlc01%2Fbrainzen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdlc01%2Fbrainzen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdlc01%2Fbrainzen/lists"}