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 can also download the whole thing

defs.h     global definitions     (Ch. 4)     113 lines
data.h     global data     (Ch. 4)     67 lines
decl.h     global declarations     (Ch. 4)     117 lines
misc.c     misc. functions     (Ch. 5)     77 lines
error.c     error handling and reporting     (Ch. 6)     56 lines
scan.c     lexical analyzer (scanner)     (Ch. 7)     530 lines
sym.c     symbol table management     (Ch. 8)     259 lines
prec.h     operator precedence table     (Ch. 9)     26 lines
expr.c     expression parser     (Ch. 9)     665 lines
cexpr.c     constant expression parser     (Ch. 9)     149 lines
stmt.c     statement parser     (Ch. 9)     329 lines
decl.c     declaration parser     (Ch. 9)     484 lines
prep.c     preprocessor     (Ch. 10)     172 lines
gen.c     code generator     (Ch. 11)     657 lines
cgen.h     target description interface     (Ch. 12)     110 lines
cg386.c     386 target description     (Ch. 12)     149 lines
main.c     compiler controller     (Ch. 13)     288 lines
                        4248 total

contact  |  privacy