Description

1 A MINIMAL COMPILER

In this chapter, you’ll write a minimal compiler that can handle only the simplest C programs. You’ll learn how to read a simple assembly program, and you’ll implement four basic compiler passes that you’ll build on throughout the rest of the book. Let’s start by looking at these compiler passes.

The Four Compiler Passes

The compiler you write in this chapter will process source code in four stages:

  1. The lexer breaks up the source code into a list of tokens. Tokens are the smallest syntactic units of a ...

Get Writing a C Compiler now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.