One obvious solution is to do two passes -- one to lay everything out, then another to generate now that offsets are known.Here's where it gets clever. Rather than two passes, they instead write the code in such a way that the code-generator function's output is also passed as a parameter to the same function.