http://t3x.org/subc/sources.html   (light|dark)

The SubC Compiler Sources

SubC is a fast and simple compiler for a clean subset of the C programming language as described in the book

Practical Compiler Construction

Its entire source code is reproduced in the files below. Chapter numbers in the table refer to the book.

You might prefer to just download the whole thing

defs.hglobal definitions(Ch. 4)113 lines
data.hglobal data(Ch. 4)67 lines
decl.hglobal declarations(Ch. 4)117 lines
misc.cmisc. functions(Ch. 5)77 lines
error.cerror handling and reporting(Ch. 6)56 lines
scan.clexical analyzer (scanner)(Ch. 7)530 lines
sym.csymbol table management(Ch. 8)259 lines
prec.hoperator precedence table(Ch. 9)26 lines
expr.cexpression parser(Ch. 9)665 lines
cexpr.cconstant expression parser(Ch. 9)149 lines
stmt.cstatement parser(Ch. 9)329 lines
decl.cdeclaration parser(Ch. 9)484 lines
prep.cpreprocessor(Ch. 10)172 lines
gen.ccode generator(Ch. 11)657 lines
cgen.htarget description interface(Ch. 12)110 lines
cg386.c386 target description(Ch. 12)149 lines
main.ccompiler controller(Ch. 13)288 lines
total4248 lines
 

contact | privacy