A Retargetable C Compiler: Design and ImplementationThis new text examines the design and implementation of Icc, a production-quality, retargetable compiler, designed at AT&T Bell Laboratories and Princeton University for the ANSI C programming language. The authors' innovative approach - a "literate program" that intermingles the text with the source code - gives a detailed tour of the code that explains the implementation and design decisions reflected in the software. And while most books describe toy compilers or focus on isolated pieces of code, the authors have made available the entire source code for a real compiler. Structured as a self-study guide that describes the real-world tradeoffs encountered in building a production-quality compiler, A Retargetable C Compiler is also useful to individuals who work in application areas using or creating language-based tools and techniques. Features: discusses the implementation and design tradeoffs made while constructing a real ANSI C compiler, illustrating the interaction between theory and practice; covers compiler theory only as needed to understand the implementation of Icc, focusing instead on practical, applied issues; encourages a deeper understanding of programming in C, by providing C programmers with a tour of the language from the perspective of compiler authors; includes coverage of code generators for the MIPS R3000, SPARC, and Intel 386 and its successors; and provides access to the full source code for the Icc compiler, the three back ends, and the code-generator generator, either on disk or via FTP. |
Contents
Preface xiii | 7 |
Storage Management | 23 |
Symbol Management | 35 |
Copyright | |
19 other sections not shown
Common terms and phrases
addr ADDRLP alignment ANSI argument array ASGN ASGNI assignment AUTO back end binary operators bit field break bytes caller calls char CNST+I code list common subexpression compiler computed constant dags declaration define EBNF emitcode enumeration type example exported expr expression extern flag floating-point forest front end FUNC funcdefn gen.c functions gencode gettok global identifiers implement INDIR initialize input instructions integer interface functions inttype IREG jump label level 42 lexical analyzer listnodes loop lvalue MIPS node nonterminal NULL offset opcodes operand operators p->sclass p->syms p->type parameter params parser parsing function pointer register allocator rvalue sclass scope SPARC specified spill stack statement static void stmt storage class string string literals struct structure switch switch statement Symbol symbol-table entry target temporary token tree tsym Type ty typedef unary unsigned unsignedtype varargs x.kids zero



