{"id":21490529,"url":"https://github.com/wuruoyu/a-working-c-compiler","last_synced_at":"2026-04-20T03:03:11.350Z","repository":{"id":273933539,"uuid":"537609452","full_name":"wuruoyu/A-Working-C-Compiler","owner":"wuruoyu","description":"Implement a working compiler for a C language subset (front-end + various optimizatons on LLVM IR + back-end)","archived":false,"fork":false,"pushed_at":"2022-12-19T18:24:10.000Z","size":5870,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T11:13:05.961Z","etag":null,"topics":["c","compiler","llvm"],"latest_commit_sha":null,"homepage":"","language":"C++","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/wuruoyu.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}},"created_at":"2022-09-16T20:26:01.000Z","updated_at":"2024-12-17T02:56:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a1cfe38-d705-4671-8876-6427c4a4cec3","html_url":"https://github.com/wuruoyu/A-Working-C-Compiler","commit_stats":null,"previous_names":["wuruoyu/a-working-c-compiler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wuruoyu/A-Working-C-Compiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuruoyu%2FA-Working-C-Compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuruoyu%2FA-Working-C-Compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuruoyu%2FA-Working-C-Compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuruoyu%2FA-Working-C-Compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wuruoyu","download_url":"https://codeload.github.com/wuruoyu/A-Working-C-Compiler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuruoyu%2FA-Working-C-Compiler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32031070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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","compiler","llvm"],"created_at":"2024-11-23T14:39:33.267Z","updated_at":"2026-04-20T03:03:11.317Z","avatar_url":"https://github.com/wuruoyu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A working compiler for a C language subset\nThis project, USCC, builds out a working compiler for a C language subset called USC ([language reference](./USCLanguage.pdf)). \nUSCC uses the LLVM framework as its code generation engine.\n\n#### Project 1: Recursive Descent Parsing\nImplemented a `LL(1) parser` that parses the program into AST. [[Handout]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/P1.pdf) [[Report]](https://github.com/wuruoyu/CS502-Compiler/blob/master/uscc/uscc/report/reportP1.pdf)\n\n#### Project 2: Semantic Analysis\nImplemented scoped symbol table that enable scoped identifier declarations, and type checking/conversion that enables conversion between `char` and `int`. [[Handout]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/p2.pdf) [[Report]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/reportP2.pdf).\n\n#### Project 3: LLVM IR Generation\nImplemented an `IREmitter` that lowers various types of AST node (e.g., `While` statement, `If` statement) to LLVM IR using `llvm::IRBuilder`. [[Handout]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/P3.pdf) [[Report]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/reportP3.pdf)\n\n#### Project 4: Static Single Assignment (SSA) generation\nImplemented a fairly new approach to generate SSA form as outlined in [this paper](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/Simple%20and%20Efficient%20Construction%20of%20Static%20Single%20Assignment%20Form.pdf), which directly generate SSA form from the high-level AST, without generating non-SSA form first as in Clang/LLVM. [[Handout]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/P4.pdf) [[Report]](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/reportP4.pdf)\n\n#### Project 5: LLVM Optimization Passes\nImplemented three LLVM optimization passes, including constant branch folding, dead block removal and loop invariant code motion (LICM). \n\n#### Project 6: Register Allocation (via graph-coloring)\nImplemented a graph-coloring register allocator with LLVM infrastructure (using `RegAllocBase` interface), following this helpful [tutorial](https://github.com/nael8r/How-To-Write-An-LLVM-Register-Allocator). The algorithm is described in the [Chatin-Brigg’s paper](https://github.com/wuruoyu/A-Working-C-Compiler/blob/master/uscc/uscc/report/Chaitin-Briggs.pdf). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuruoyu%2Fa-working-c-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwuruoyu%2Fa-working-c-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuruoyu%2Fa-working-c-compiler/lists"}