The Structure of a Compiler
Compiler technology is a well-studied field of computer science. The high-level task is to translate a source language into machine code. Typically, this task is divided into three parts, the frontend, the middle end, and the backend. The frontend deals mainly with the source language, while the middle end performs transformation to improve the code and the backend is responsible for the generation of machine code. Since the LLVM core libraries provide the middle end and the backend, we will focus on the frontend within this chapter.
In this chapter, you will cover the following sections and topics:
- 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 and show how grammar is used to define a language
- Lexical analysis, which discusses how to implement a lexer for the language
- Syntactical analysis, which...