3 BINARY OPERATORS
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 ...
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.