public override object VisitIterationStatement([NotNull] CMinusParser.IterationStatementContext context)
        {
            this.Visit(context.logicalOrExpression());

            this.internalScope++;
            this.symbolTable.EnterScope();

            this.Visit(context.statement());

            this.symbolTable.ExitScope();
            this.internalScope--;

            return(null);
        }
        public override object VisitIterationStatement([NotNull] CMinusParser.IterationStatementContext context)
        {
            int logicalExpressionLabel = this.labelGenerator.GenerateLabel();
            int statementBodyLabel     = this.labelGenerator.GenerateLabel();

            this.writer.WriteUnconditionalJump(logicalExpressionLabel);

            this.writer.WriteLabel(statementBodyLabel);
            this.Visit(context.statement());

            this.writer.WriteLabel(logicalExpressionLabel);
            this.Visit(context.logicalOrExpression());

            this.writer.WriteJumpIfTrue(statementBodyLabel);

            return(null);
        }
        public override object VisitIterationStatement([NotNull] CMinusParser.IterationStatementContext context)
        {
            this.labelGenerator.IncrementWhileCount();

            string expressionLabel = this.labelGenerator.GenerateWhileConditionLabel();
            string loopLabel       = this.labelGenerator.GenerateWhileLabel();

            this.writer.WriteUnconditionalJump(expressionLabel);

            this.writer.WriteLabel(loopLabel);
            this.Visit(context.statement());

            this.writer.WriteLabel(expressionLabel);
            this.Visit(context.logicalOrExpression());
            this.writer.WriteUnaryArithmeticExpression("!");

            this.writer.WriteConditionalJump(loopLabel);

            return(null);
        }