14.11. Why So Many Procedures?

At this point, you may think I've pretty much gone off the deep end in terms of deeply nested procedures. There is admittedly a lot of overhead here. But there's a method in my madness. As in the case of UnOp, I'm looking ahead to the time when we're going to want better code generation. The way the code is organized, we can achieve this without major modifications to the program. For example, in cases where the value pushed onto the stack does not have to be converted, it's still better to use the “pop and add” instruction. If we choose to test for such cases, we can embed the extra tests into PopAdd and PopSub without changing anything else much.