{"id":13419066,"url":"https://github.com/wgtdkp/wgtcc","last_synced_at":"2025-04-04T08:05:50.832Z","repository":{"id":45901322,"uuid":"49500145","full_name":"wgtdkp/wgtcc","owner":"wgtdkp","description":"A small C11 compiler","archived":false,"fork":false,"pushed_at":"2021-01-31T07:55:46.000Z","size":8270,"stargazers_count":771,"open_issues_count":18,"forks_count":130,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-03-28T07:04:39.175Z","etag":null,"topics":["assembly","c11","compilers","cpp11","preprocessor"],"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/wgtdkp.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}},"created_at":"2016-01-12T12:57:40.000Z","updated_at":"2025-03-27T15:36:47.000Z","dependencies_parsed_at":"2022-09-17T04:42:10.609Z","dependency_job_id":null,"html_url":"https://github.com/wgtdkp/wgtcc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wgtdkp%2Fwgtcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wgtdkp%2Fwgtcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wgtdkp%2Fwgtcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wgtdkp%2Fwgtcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wgtdkp","download_url":"https://codeload.github.com/wgtdkp/wgtcc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142013,"owners_count":20890651,"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","c11","compilers","cpp11","preprocessor"],"created_at":"2024-07-30T22:01:10.842Z","updated_at":"2025-04-04T08:05:50.812Z","avatar_url":"https://github.com/wgtdkp.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","C++"],"sub_categories":[],"readme":"# wgtcc [![Build Status](https://travis-ci.org/wgtdkp/wgtcc.svg?branch=master)](https://travis-ci.org/wgtdkp/wgtcc) [![codecov](https://codecov.io/gh/wgtdkp/wgtcc/branch/master/graph/badge.svg)](https://codecov.io/gh/wgtdkp/wgtcc) \u003ca href=\"https://996.icu\"\u003e\u003cimg src=\"https://img.shields.io/badge/link-996.icu-red.svg\"\u003e\u003c/a\u003e\n\nA small _C11_ compiler in _C++11_.\n\n## Environment\n\n  1. x86-64\n  2. linux 4.4.0\n  3. clang 3.8.0 (or any version supports C++11)\n\n## Build\n\n  ```bash\n  cmake . -Bbuild\n  cd build \u0026\u0026 make \u0026\u0026 make test\n  ```\n\n## Install\n\n  ```bash\n  make install\n  ```\n\nThen you can play with the examples:\n\n  ```bash\n  wgtcc example/heart.c\n  wgtcc example/chinese.c\n  ```\n\n## Without Install\n\nTry this:\n\n  ```bash\n  ./wgtcc -no-pie -I../include ../example/heart.c\n  ```\n\n## Notice\n\nAs wgtcc doesn't support PIC/PIE, if you are using gcc \u003e= 6.2.0, specify **_-no-pie_** explicitly:\n\n```bash\nwgtcc -no-pie example/heart.c\nwgtcc -no-pie example/chinese.c\n```\n\n## Goal\n\n**wgtcc** is aimed to implement the full C11 standard with some exceptions:\n\n1. Some features are supported only in grammar level(like keyword _register_).\n2. Features that disgusting me are removed (like default _int_ type without type specifier).\n3. Some non standard GNU extensions are supported, but you should not rely on **wgtcc** of a full supporting.\n\n## Front End\n\nA basic recursive descent parser.\n\n## Back End\n\n**wgtcc** generates code from AST directly. The algorithm is TOSCA (top of stack caching). It is far from generating efficient code, but at least it works and generates code efficently.\n\n## Memory Management\n\nThrough **wgtcc** was written in C++, I paid no effort for memory management except for a simple memory pool to accelerate allocations. _only_ _new_ is preferred because **wgtcc** runs fast and exits immediately after finishing parsing and generating code.\n\n## Reference\n\n1. Compilers Principles, Techniques and Tools. Second Edition.\n2. [N1548, C11 standard draft](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf)\n3. [64-ia-32-architectures-software-developer-manual-325462](http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-manual-325462.html)\n4. [8cc](https://github.com/rui314/8cc)\n5. [9c](https://github.com/huangguiyang/9c)\n6. [macro expansion algorithm](https://github.com/wgtdkp/wgtcc/blob/master/doc/cpp.algo.pdf)\n\n## Todo\n\n- [ ] support GNU extensions (e.g. keyword \\_\\_attribute__)\n- [ ] support variable length array\n- [ ] optimization (e.g. register allocation)\n- [x] support type qualification\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwgtdkp%2Fwgtcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwgtdkp%2Fwgtcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwgtdkp%2Fwgtcc/lists"}