Discussion on: Crafting an Interpreter in Zig - part 2

apatriarca profile image
Antonio Patriarca

I am currently doing a Crafting Interpreters run as well. While I like your approach for the binary op macro, I personally found it was more work then just copying the code multiple times. Particularly because after challenge 4 suggenstion it is just two lines of code for each op:

self.stack[self.stackTop - 2] += self.stack[self.stackTop - 1];
self.stackTop -= 1;
Enter fullscreen mode Exit fullscreen mode