public Object visitPopExpression(SIRPopExpression oldSelf, CType oldTapeType) {  SIRPopExpression self = (SIRPopExpression) super.visitPopExpression(oldSelf, oldTapeType);  JLocalVariableExpression ref = new JLocalVariableExpression(null, var);  return new SIRPeekExpression(new JPostfixExpression(null, OPE_POSTINC, ref), oldTapeType);
private boolean inExpressionStatement = false;  public Object visitExpressionStatement(JExpressionStatement self, JExpression expr) { boolean oldInExpressionStatement = inExpressionStatement; if (expr instanceof SIRPopExpression) {inExpressionStatement = true;} Object result = super.visitExpressionStatement(self,expr); inExpressionStatement = oldInExpressionStatement; return result; }  public Object visitPopExpression(SIRPopExpression oldSelf, CType oldTapeType) {  SIRPopExpression self = (SIRPopExpression) super .visitPopExpression(oldSelf, oldTapeType);  int ntimes = self.getNumPop();  if (inExpressionStatement) { JExpression lhs = new JLocalVariableExpression(null, var); JExpression rhs = new JAddExpression( new JLocalVariableExpression(null, var), new JIntLiteral(ntimes) ); return new JAssignmentExpression(lhs,rhs);
    private static JStatement popToPeek(JStatement orig) {        // define a variable to be our counter of pop position        final JVariableDefinition var =            new JVariableDefinition(/* where */ null,                                    /* modifiers */ 0,                                    /* type */ CStdType.Integer,                                    /* ident */                                    LoweringConstants.getUniqueVarName(),                                    /* initializer */                                    new JIntLiteral(0));        // make a declaration statement for our new variable        JVariableDeclarationStatement varDecl =            new JVariableDeclarationStatement(null, var, null);        // adjust the contents of <orig> to be relative to <var>        orig.accept(new SLIRReplacingVisitor() {                public Object visitPopExpression(SIRPopExpression oldSelf,                                                 CType oldTapeType) {                    // Recurse into children.                    SIRPopExpression self = (SIRPopExpression)                        super.visitPopExpression(oldSelf,                                                 oldTapeType);                    // reference our var                    JLocalVariableExpression ref = new JLocalVariableExpression(null,                                                                                var);                    // Return new peek expression.                    return new SIRPeekExpression(new JPostfixExpression(null,                                                                        OPE_POSTINC,                                                                        ref),                                                 oldTapeType);                }                public Object visitPeekExpression(SIRPeekExpression oldSelf,                                                  CType oldTapeType,                                                  JExpression arg) {                    // Recurse into children.                    SIRPeekExpression self = (SIRPeekExpression)                        super.visitPeekExpression(oldSelf,                                                  oldTapeType,                                                  arg);                    // reference our var                    JLocalVariableExpression ref = new JLocalVariableExpression(null,                                                                                var);                    // Return new peek expression.                    return new SIRPeekExpression(new JAddExpression(null, ref, arg),                                                 oldTapeType);                }            });        // return the block        JStatement[] statements = {varDecl, orig};        return new JBlock(null, statements, null);    }