Chapter 3: The Structure of a Compiler
Compiler technology is a well-studied field of computer science. Its high-level task is to translate a source language into machine code. Typically, this task is divided into two parts: the frontend and the backend. The frontend mainly deals with the source language, while the backend is responsible for generating machine code.
In this chapter, we will cover the following topics:
- The building blocks of a compiler, in which you will learn about the components typically found in a compiler.
- An arithmetic expression language, which will introduce you to an example language. You will learn how grammar is used to define a language.
- Lexical analysis, which will discuss how you implement lexers for the language.
- Syntactical analysis, which covers how to construct a parser from grammar.
- Semantic analysis, in which you will learn how a sematic check can be implemented.
- Code generation with the LLVM backend, which will discuss...