{"id":16919337,"url":"https://github.com/clementtsang/rustcc","last_synced_at":"2025-03-23T17:30:49.129Z","repository":{"id":49373002,"uuid":"162782836","full_name":"ClementTsang/rustcc","owner":"ClementTsang","description":"A (toy) C compiler written in Rust with no dependencies.","archived":false,"fork":false,"pushed_at":"2024-05-24T15:25:39.000Z","size":191,"stargazers_count":60,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T22:11:29.468Z","etag":null,"topics":["assembly","c","compiler","rust","x86"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ClementTsang.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":"2018-12-22T04:58:28.000Z","updated_at":"2025-03-13T17:53:34.000Z","dependencies_parsed_at":"2024-10-28T16:43:26.197Z","dependency_job_id":"764f3823-4b70-46a2-ba16-230fbf18a958","html_url":"https://github.com/ClementTsang/rustcc","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/ClementTsang%2Frustcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClementTsang%2Frustcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClementTsang%2Frustcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClementTsang%2Frustcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ClementTsang","download_url":"https://codeload.github.com/ClementTsang/rustcc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245140751,"owners_count":20567440,"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":["assembly","c","compiler","rust","x86"],"created_at":"2024-10-13T19:44:04.800Z","updated_at":"2025-03-23T17:30:49.084Z","avatar_url":"https://github.com/ClementTsang.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rustcc - a Rust C compiler \nA basic C compiler written in Rust that compiles C code into x86 assembly, following GAS/AT\u0026T syntax, with no external Rust dependencies.  Inspired by [this post by Nora Sandler](https://norasandler.com/2017/11/29/Write-a-Compiler.html).\n\nNote this is mostly done for learning, and isn't intended to be used seriously.\n\n## Features\nCurrently, rustcc supports the following features:\n* Unary operators (logical negation, bitwise complements, negation)\n* Binary operators (basic arithmetic, bitwise operations, comparisons)\n* Local variables (assignment, declaration, variable calling, postfix and prefix incrementing)\n* If-else branching\n* Ternary operator\n* While loops, do-while loops, for loops, break, continue\n* Function calling and creation\n\nAs of now, rustcc only supports variables of type int.\n\n\n## Installation\nTo install, ensure beforehand that you have [Rust and Cargo installed.](https://www.rust-lang.org/tools/install)  After that, clone the repository.  Then, run ``cargo build --release``.\n\n## Usage\nTo use the compiler, run the `rustcc` script as follows:\n```\n./rustcc /path/to/source.c\n```\nUpon running, the compiled executable file will be in the same directory and name as the input source file.  The created assembly ``source.s`` file will be deleted upon running the script.\n\nAlternatively, you can directly run ``./target/release/rustcc /path/to/source.c`` (or ``target/release/rustcc.exe /path/to/source.c`` on Windows) to retain the assembly file.\n\n## Disclaimer\nrustcc is a project done purely out of personal interest.  The compiled x86 code is most likely not optimized and the possibility of something not working or being supported is quite probable.  I am not responsible for anything going wrong with the use of this.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclementtsang%2Frustcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclementtsang%2Frustcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclementtsang%2Frustcc/lists"}