Overview
Compilers are at the heart of everything programmers doāand theyāre cool as heckābut they have an intimidating reputation. Writing a C Compiler makes this fascinating topic fun and accessible. This book is a step-by-step guide to writing your own compiler for a large subset of C. Your compiler will generate assembly code for the ubiquitous x64 processor architecture, so youāll learn what it takes to compile a real-world programming language to run on a real-world processor.
Youāll build a working compiler for the simplest possible C programs in Chapter 1, then add a new feature in each subsequent chapter. You wonāt need any prior knowledge of compiler construction or assembly code, and the implementation is presented in pseudocode, so you can write your compiler in whatever language you like.Ā
Youāll learn how to:
- Write a lexer and recursive descent parser to turn source code into an abstract syntax tree (AST)
- Implement arithmetic operations, control-flow statements, and other C language constructs in x64 assembly
- Use your systemās calling convention to call functions defined in external libraries
- Perform several common optimizations, including constant folding and dead store elimination
- Write a graph coloring register allocator to efficiently assign values to hardware registers
In Writing a C Compiler, youāll tackle a fun, challenging projectāand gain a deeper understanding of the code you write and the systems it runs on.
This book title, Writing a C Compiler (Build a Real Programming Language from Scratch), ISBN: 9781718500426, by Nora Sandler, published by No Starch Press (September 24, 2024) is available in paperback. Our minimum order quantity is 25 copies. All standard bulk book orders ship FREE in the continental USA and delivered in 4-10 business days.
Unlike Amazon and other retailers who may also offer Writing a C Compiler (Build a Real Programming Language from Scratch) books on their website, we specialize in large quantities and provide personal service, from trusted, experienced, friendly people in Portland, Oregon. We offer a Price Match Guarantee, and QuickQuote form, to make purchasing quick and easy.
Prefer to work with a human being when you order Writing a C Compiler (Build a Real Programming Language from Scratch) books in bulk? Our Book Specialists are standing by Monday-Friday 8-5 PST, ready to help!