{"id":17654673,"url":"https://github.com/ubugeeei/ubcc","last_synced_at":"2025-10-05T04:15:32.374Z","repository":{"id":65297726,"uuid":"584701916","full_name":"ubugeeei/ubcc","owner":"ubugeeei","description":"A toy C Compiler implemented by Rust.","archived":false,"fork":false,"pushed_at":"2023-02-04T01:04:34.000Z","size":168,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T06:43:01.467Z","etag":null,"topics":["c","c-compiler","cc","compiler","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/ubugeeei.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-01-03T09:44:51.000Z","updated_at":"2024-04-29T19:04:49.000Z","dependencies_parsed_at":"2023-02-17T14:31:13.080Z","dependency_job_id":null,"html_url":"https://github.com/ubugeeei/ubcc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ubugeeei/ubcc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubugeeei%2Fubcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubugeeei%2Fubcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubugeeei%2Fubcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubugeeei%2Fubcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ubugeeei","download_url":"https://codeload.github.com/ubugeeei/ubcc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubugeeei%2Fubcc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278406903,"owners_count":25981708,"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-05T02:00:06.059Z","response_time":54,"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":["c","c-compiler","cc","compiler","rust"],"created_at":"2024-10-23T12:35:33.488Z","updated_at":"2025-10-05T04:15:32.343Z","avatar_url":"https://github.com/ubugeeei.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ubcc\n\nA toy C Compiler implemented by Rust.\n\n## Usage\n\n```sh\n# first time\nmake\n\n# build and testing\nmake build\nmake e2e\n```\n\n## Able to compile\n\n### int literals\n\n```c\nint main() {\n    return 0;\n}\n```\n\n```c\nint main() {\n    return 42;\n}\n```\n\n### binary expressions\n\n```c\nint main() {\n    return 5 + 20 - 4;\n}\n```\n\n```c\nint main() {\n    return 5 + 6 * 7;\n}\n```\n\n```c\nint main() {\n    return 5 * (9 - 6);\n}\n```\n\n```c\nint main() {\n    return (3 + 5) / 2;\n}\n```\n\n### compare\n\n```c\nint main() {\n    return 0 \u003c 1;\n}\n```\n\n```c\nint main() {\n    return 1 \u003e= 0;\n}\n```\n\n```c\nint main() {\n    return 0 \u003c= 1;\n}\n\n```\n\n```c\nint main() {\n    return 0 != 1;\n}\n\n```\n\n```c\nint main() {\n    return 42 == 42;\n}\n\n```\n\n### variables\n\n```c\nint main() {\n    int a = 2;\n    return a + 2;\n}\n```\n\n```c\nint main() {\n    int a = 10;\n    a = a + 2;\n    return a;\n}\n```\n\n```c\nint main() {\n    int x = 2;\n    int y = 5;\n    return x + y;\n}\n```\n\n### pointer\n\n```c\nint main() {\n    int x = 3;\n    int *y = \u0026x;\n    return *y;\n}\n```\n\n```c\nint main() {\n    int x = 0;\n    int *y = \u0026x;\n    *y = 3;\n    return x;\n}\n```\n\n```c\nint main() {\n    int x = 100;\n    int a = 200;\n\n    int *p = \u0026x;\n    p = p + 1;\n    return *p;\n}\n```\n\n```c\nint main() {\n    int x = 100;\n    int a = 200;\n\n    int *p = \u0026a;\n    p = p - 1;\n\n    return *p;\n}\n```\n\n### collections\n\n```c\nint main() {\n    int a[2];\n    *a = 1;\n    return *a;\n}\n```\n\n```c\nint main() {\n    int a[2];\n    *a = 1;\n    return a[0];\n}\n```\n\n```c\nint main() {\n    int a[2];\n    a[0] = 1;\n    a[1] = 2;\n    return a[1];\n}\n```\n\n```c\nint main() {\n    int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};\n    return a[9];\n}\n```\n\n```c\nint main() {\n    char *a = \"ABC\";\n    return *a;\n}\n```\n\n```c\nint main() {\n    char *a = \"ABCDEF\";\n    return a[5];\n}\n```\n\n### branches\n\n```c\nint main() {\n    int foo = 4;\n    int z = 5;\n    if (foo / 2 == 2) z = 50;\n    return foo + z;\n}\n```\n\n```c\nint main() {\n    int foo = 100;\n    int z;\n    if (foo / 2 == 50) {\n        z = 50;\n    } else {\n        z = 100;\n    }\n    return foo + z;\n}\n```\n\n### loop\n\n```c\nint main() {\n    int i = 0;\n    while (i \u003c 10) {\n      i = i + 1\n    };\n    return i;\n}\n```\n\n```c\nint main() {\n    int i = 0;\n    for (i = 1; i \u003c 10; i = i + 2) {\n        i = i - 1;\n    }\n    return i;\n}\n```\n\n### function\n\n```c\nint foo(int i) {\n    return i;\n}\n\nint main() {\n    int a = foo(10);\n    return 10;\n}\n```\n\n### builtin function\n\n```c\nint main() {\n    int x = 0;\n    return sizeof(x);\n}\n```\n\n### comments\n\n```c\nint main() {\n    /*\n     * comment\n     */\n    return 0;\n}\n```\n\n```c\nint main() {\n    // comment\n    return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubugeeei%2Fubcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubugeeei%2Fubcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubugeeei%2Fubcc/lists"}