The SubC Compiler

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

Practical Compiler Construction

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 current version rather than the book version.

Current version: subc-20140407.tgz (tgz, ~110KB), README
DOS executables: (experimental, zip, ~140KB)
Book version: (zip, ~75KB), README
View the compiler sources online (book version)

The Windows runtime support code has been written by Jean-Marc Lienher ( The Darwin back-end and startup module have been contributed by Romain LWPB. Many thanks for the great effort!

Current Targets

The current version supports the following platforms:

(The book version runs on FreeBSD/386 exclusively.)

FreeBSD   386   armv6 x86-64
Linux   386     x86-64
NetBSD     x86-64
OpenBSD   386      
Windows/MinGW   386      
Darwin     x86-64
  DOS     8086      
stable untested experimental

Stable back ends are regression-tested before each release. Untested ports should be stable but are not regularly tested due to lack of resources.

Changes since the Book Version