a small C11 compiler in C++
x86-64 only
$ make install # root required
$ make test
or you can play with the examples:
./build/wgtcc heart.c
./build/wgtcc chinese.c
wgtcc is aimed to implement the full C11 standard with some exceptions:
- some features are supported only in grammar level(like keyword register)
- features that disgusting me are removed(like default int type without type specifier)
- some non standard GNU extensions are supported, but you should not rely on wgtcc of a full supporting
A basic recursive descent parser
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.
Through wgtcc was wirtten 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.
- Compilers Principles, Techniques and Tools. second Edition.
- N1548, C11 standard draft
- 64-ia-32-architectures-software-developer-manual-325462
- 8cc
- macro expansion algorithm
- support type qualification
- support variable length array