{"id":13778935,"url":"https://github.com/nickdesaulniers/bf_interpreter_jit_compiler","last_synced_at":"2025-04-14T16:52:03.094Z","repository":{"id":146778525,"uuid":"9740617","full_name":"nickdesaulniers/bf_interpreter_jit_compiler","owner":"nickdesaulniers","description":"Teach myself about interpreters, JITs, and compilers using the Brainfuck language as the toy language","archived":false,"fork":false,"pushed_at":"2021-12-21T18:42:40.000Z","size":38,"stargazers_count":85,"open_issues_count":1,"forks_count":14,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-28T05:31:33.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nickdesaulniers.github.io/blog/2015/05/25/interpreter-compiler-jit/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickdesaulniers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2013-04-29T03:49:59.000Z","updated_at":"2025-01-13T08:15:57.000Z","dependencies_parsed_at":"2024-01-07T00:38:58.845Z","dependency_job_id":"7a31bbf4-da1f-4a0a-9ccc-b88140d8f6d8","html_url":"https://github.com/nickdesaulniers/bf_interpreter_jit_compiler","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/nickdesaulniers%2Fbf_interpreter_jit_compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdesaulniers%2Fbf_interpreter_jit_compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdesaulniers%2Fbf_interpreter_jit_compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdesaulniers%2Fbf_interpreter_jit_compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickdesaulniers","download_url":"https://codeload.github.com/nickdesaulniers/bf_interpreter_jit_compiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248922347,"owners_count":21183935,"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-08-03T18:00:59.156Z","updated_at":"2025-04-14T16:52:03.071Z","avatar_url":"https://github.com/nickdesaulniers.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Interpreter, Compiler, JIT\nThis repo contains three programs used in my [blog post](https://nickdesaulniers.github.io/blog/2015/05/25/interpreter-compiler-jit/); an interpreter, a compiler, and a Just In Time (JIT) compiler for the brainfuck language.  It's meant to show how similar these techniques are.\n\n### Portability\nWhile all three are written in C, only the interpreter should be portable, even to emscripten.  The compiler and JIT is highly dependant on the x64 Instruction Set Architecture (ISA), and Linux/OSX style calling convention.  The assembler is made for OSX, but you can probably just link using GCC/Clang on Linux.\n\n### Warning\nI take no responsibility for you running arbitrary brainfuck programs you found on the Internet through the compiler or the JIT.  I would only run either in a virtual machine, just to be safe!  You've been warned!\n\n## Building\n### Native\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n### Emscripten\nOnly the interpreter is portable to JavaScript.\n\n```bash\nmkdir build\ncd build\ncp ../samples/* .\nemcmake cmake ..\nemmake make\n```\n\n## Running\n### The Interpreter\n```bash\n./interpreter ../samples/hello_world.bf\n```\nor Emscripten-ized:\n\n```bash\nnode interpreter.js hello_world.bf\n```\n\n### The Compiler\n```bash\n./compiler ../samples/hello_world.bf \u003e temp.s\n../assemble.sh temp.s\nrm temp.s\n./a.out\n```\n\n### The JIT\n```bash\n./jit ../samples/hello_world.bf\n```\n\n## License\nThe code in this repo _except_ the code in `samples/` has the following license:\n\n```bash\nTHE BEER-WARE LICENSE (Revision 42):\n\u003cnick@mozilla.com\u003e wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think\nthis stuff is worth it, you can buy me a beer in return.\n\nNick Desaulniers\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickdesaulniers%2Fbf_interpreter_jit_compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickdesaulniers%2Fbf_interpreter_jit_compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickdesaulniers%2Fbf_interpreter_jit_compiler/lists"}