{"id":40081671,"url":"https://github.com/nsauzede/compbook_test","last_synced_at":"2026-01-19T09:08:06.205Z","repository":{"id":77856436,"uuid":"344293109","full_name":"nsauzede/compbook_test","owner":"nsauzede","description":"My notes following the \"Compiler Book\"","archived":false,"fork":false,"pushed_at":"2024-02-11T10:53:00.000Z","size":2379,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-02-11T11:38:43.027Z","etag":null,"topics":["compiler","hacktoberfest","programming-language"],"latest_commit_sha":null,"homepage":"","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/nsauzede.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}},"created_at":"2021-03-03T23:32:19.000Z","updated_at":"2023-01-31T01:10:44.000Z","dependencies_parsed_at":"2024-02-11T11:36:42.432Z","dependency_job_id":null,"html_url":"https://github.com/nsauzede/compbook_test","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nsauzede/compbook_test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2Fcompbook_test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2Fcompbook_test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2Fcompbook_test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2Fcompbook_test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsauzede","download_url":"https://codeload.github.com/nsauzede/compbook_test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2Fcompbook_test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["compiler","hacktoberfest","programming-language"],"created_at":"2026-01-19T09:08:06.064Z","updated_at":"2026-01-19T09:08:06.193Z","avatar_url":"https://github.com/nsauzede.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Experiments following the Compiler Book\nMy notes following the excellent [Compiler Book](https://www.sigbus.info/compilerbook).\n\nEach stepXX subdir represents my own interpretation of the book steps cues.\nFirst steps lead to almost identical produced code compared to the cues.\nBut from steps to steps, the book gives less and less C and asm code cues, which makes the process even more challenging and interesting IMHO.. :-)\n\nThe ultimate goal is to proceed through the end of the book, and obtain a self-hosted C compiler ! \\o/\n\nHave fun following the book yourself ! I recommend trying it !!\n\n# How to test all the steps\n\n```shell\nfind . -name \"ste*\" -type d -exec make  clean all check test -C '{}' \\;\n```\n\n# Roadmap\n## Driver phases\n- [ ] preprocessor (.c)\n- [x] tokenizer (Token *)\n- [x] parser (Obj *)\n- [x] code generator (.s)\n- [ ] assembler (.o)\n- [ ] linker (.elf)\n## Compiler features\n- [x] compile integer into executable that exits with it\n- [x] +,-,*,/,() operators\n- [x] if/for/while\n- [x] \u0026,* operators, int type and local variable\n- [x] functions call\n- [x] array type, [] operator\n- [x] global var, char type\n- [x] string literal\n- [x] compile from file\n- [x] GNU statement expression\n- [x] C tests, Quine support\n- [x] octal/hex in strings\n- [x] block scope (local vars shadowing)\n- [x] .file/.loc\n- [x] comma operator\n- [x] struct\n- [x] -\u003e operator\n- [x] union\n- [x] short/long, function decl\n- [x] void\n- [x] typedef, type cast\n- [x] bool, enum\n- [x] static funcs, loop variables\n- [x] assignment ops\n- [x] hex/oct/bin literals\n- [x] more unary/binary ops\n- [x] incomplete types / array to pointer decay\n- [x] goto/labels\n- [x] break/continue/switch\n- [x] \u003c\u003c,\u003e\u003e,\u003c\u003c=,\u003e\u003e=,?: ops\n- [x] const expressions\n- [x] treat ... as a pseudo identifier (to accept variadic arg declaration)\n- [ ] lots of var initializers\n- [ ] flexible array member\n- [ ] extern, static local variables\n- [ ] compound literals, empty return, global variables\n- [ ] do while\n- [ ] variadic function\n- [ ] signed/unsigned\n- [ ] self-host ?\n\n# Old notes\n*Note: initially I planned to code it in vlang (which would have made it NOT self-hosted ofc), but the clarity of the actual C code samples of the book, made me change my mind :-)*\n\nOnce reached, subsequent goals could be : (in no specific order/priority/realism)\n- [ ] rewrite the compiler in another language\n- [ ] output different assembly than x64  (eg: 16-bit real-mode x86)\n- [ ] transpile to another language (eg: vlang, Nelua, etc..)\n- [ ] rewrite the compiler to compile another language/grammar than C (eg: V, or brand-new \"toy\" one..)\n- [ ] make this other grammar compiler self-hosted, too\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsauzede%2Fcompbook_test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnsauzede%2Fcompbook_test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsauzede%2Fcompbook_test/lists"}