{"id":13644073,"url":"https://github.com/nlsandler/write_a_c_compiler","last_synced_at":"2025-04-21T06:32:52.688Z","repository":{"id":37733490,"uuid":"112534651","full_name":"nlsandler/write_a_c_compiler","owner":"nlsandler","description":"Test suite to help you write your own C compiler","archived":false,"fork":false,"pushed_at":"2023-10-11T22:37:47.000Z","size":44,"stargazers_count":860,"open_issues_count":4,"forks_count":97,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-11-09T16:43:41.511Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://norasandler.com/2017/11/29/Write-a-Compiler.html","language":"C","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/nlsandler.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}},"created_at":"2017-11-29T22:21:51.000Z","updated_at":"2024-11-04T15:38:22.000Z","dependencies_parsed_at":"2024-01-14T09:29:20.730Z","dependency_job_id":null,"html_url":"https://github.com/nlsandler/write_a_c_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/nlsandler%2Fwrite_a_c_compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlsandler%2Fwrite_a_c_compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlsandler%2Fwrite_a_c_compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlsandler%2Fwrite_a_c_compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nlsandler","download_url":"https://codeload.github.com/nlsandler/write_a_c_compiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008278,"owners_count":21359957,"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-02T01:01:57.166Z","updated_at":"2025-04-21T06:32:47.678Z","avatar_url":"https://github.com/nlsandler.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Write a C Compiler!\n\n**This repo is no longer active. The latest version of this test suite, which accompanies the [Writing a C Compiler book](https://nostarch.com/writing-c-compiler), is available [here](https://github.com/nlsandler/writing-a-c-compiler-tests/).**\n\nThis is a set of C test programs to help you write your own compiler. They were written to accompany [this tutorial](https://norasandler.com/2017/11/29/Write-a-Compiler.html).\n\n## Usage\n\n### test all\n```\n./test_compiler.sh /path/to/your/compiler\n```\n\n### test specific stages\nTo test stage 1 and stage 3,\n```\n./test_compiler.sh /path/to/your/compiler 1 3\n```\nTo test from stage 1 to stage 6,\n```\n./test_compiler.sh /path/to/your/compiler `seq 1 6`\n```\n\nIn order to use this script, your compiler needs to follow this spec:\n\n1. It can be invoked from the command line, taking only a C source file as an argument, e.g.: `./YOUR_COMPILER /path/to/program.c`\n\n2. When passed `program.c`, it generates executable `program` in the same directory.\n\n3. It doesn’t generate assembly or an executable if parsing fails (this is what the test script checks for invalid test programs).\n\nThe script doesn’t check whether your compiler outputs sensible error messages, but you can use the invalid test programs to test that manually.\n\n## Contribute\n\nAdditional test cases welcome! You can also file issues here, either about the test suite itself or about the content of the tutorial.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlsandler%2Fwrite_a_c_compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlsandler%2Fwrite_a_c_compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlsandler%2Fwrite_a_c_compiler/lists"}