Got it.
codeWrite(exp) in that example is analogous to CompilationEngine.CompileExpression() and CompileTerm() and whatever other CompileXxx() they may call. All of my calls to VmWriter are within the CompilationEngine functions that parse the expressions syntax.
For example when parsing "a+2",
CompileExpression() calls CopmpileTerm()
CompileTerm() parses the variable name and calls VmWriter.WritePush()
to write the "push a" VM code.
CompileExpression() advances and parses the '+' operator and remembers it for later.
CompileExpression() advances and calls CompileTerm()
CompileTerm() parses the constant and calls VmWriter.WritePush()
to write the "push constant 2" VM code.
CompileExpression() calls VmWriter.WriteArithmetic() to write the "add" VM code.
Finally, CompileExpression() returns to it's caller.
It is important that "remember it for later" uses a local variable. (If it used an object variable, it would be overwritten during a recursive call to CompileExpression().)
--Mark