rust posts

Subscribe to just rust posts via RSS.

Part 9: Statements

So the parser can handle a single expression, but since we’re not building a Lisp, that’s not enough. It needs to handle multiple statements. For context, an expression is a piece of code that represents a value whereas a statement is a piece of code that can be executed but does not result in a value.

Part 7: Cleaning Up Binary Operators

The code from part 4 that checks whether a pair of binary operators should be grouped to the left or right works, but I’m not particularly happy with it. The issue is that it needs to pattern match on the right node twice: first in the should_group_left function, and then again in combine_with_binary_operator if should_group_left returned true.