August 2024
Intermediate to advanced
792 pages
23h 9m
English

In this chapter, you’ll implement five new operators: addition, subtraction, multiplication, division, and the remainder operator. These are all binary operators, which take two operands. This chapter won’t require any new compiler stages; you’ll just extend each of the stages you’ve already written. In the parsing stage, you’ll see why recursive descent parsing doesn’t work well for binary expressions. Instead, you’ll use a different technique, precedence climbing, which will be easier to build on in later ...
Read now
Unlock full access