Writing a C Compiler: Build a Real Programming Language from Scratch

Writing a C Compiler: Build a Real Programming Language from Scratch

by Nora Sandler
Writing a C Compiler: Build a Real Programming Language from Scratch

Writing a C Compiler: Build a Real Programming Language from Scratch

by Nora Sandler

eBook

$35.99 
Available for Pre-Order. This item will be available on September 24, 2024

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

A hands-on, example-filled guide to the theory and practice of writing a C compiler: a computer program that translates code written by programmers into code the computer can read.

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.

Product Details

ISBN-13: 9781718500433
Publisher: No Starch Press
Publication date: 09/24/2024
Sold by: Penguin Random House Publisher Services
Format: eBook
Pages: 792
Sales rank: 743,630

About the Author

Nora Sandler is a software engineer based in Seattle. She holds a BS in computer science from the University of Chicago, where she researched the implementation of parallel programming languages. After several years as a penetration tester, she found her way back to compilers. Most recently, she worked on domain-specific languages at an endpoint security company. You can read her blog about pranks, compilers, and other computer science topics at https://norasandler.com.
From the B&N Reads Blog

Customer Reviews