SubC is a fast and simple public domain compiler for a clean subset of
the C programming language. It can compile itself and passes
gcc -Wall -pedantic. Its internals are
described in detail in the book
Note that SubC is a teaching vehicle rather than a production compiler. Check the README files to find out what it can and cannot do. If you are planning to do something more serious with SubC, you may want to get the stable or experimental version rather than the book version.
|
SubC now has an synthesizing back-end, which
generates more efficient code than the book version of the compiler.
It is included in the currentbranch and enabled by default. The Windows runtime support code has been written by Jean-Marc Lienher (cod5.org). Many thanks for the great effort! |
?: is an expression, not
a logic op. (a?b,c:d is a valid expression).kprintf() function, which is
like fprintf(), but uses a file descriptor.#error, #line, and
#pragma commands.FILEs are now structs and can no longer be mistaken for
ints by the type checker.jmp_buf is now a struct; setjmp() and
longjmp() must be called with &jmp_buf (this
is a bug).auto and register keywords are now
recognized (as no-ops).&array is now valid syntax (you no longer have to write
&array[0]).