public override void Print(Output output) { output.Print("for "); m_r.GetTarget(m_register + 3, Begin - 1).Print(output); var n = m_register + 2 + m_length; for (int r1 = m_register + 4; r1 <= n; r1++) { output.Print(", "); m_r.GetTarget(r1, Begin - 1).Print(output); } output.Print(" in "); Expression value = null; value = m_r.GetValue(m_register, Begin - 1); value.Print(output); // TODO: Optimize code if (!value.IsMultiple) { output.Print(", "); value = m_r.GetValue(m_register + 1, Begin - 1); value.Print(output); if (!value.IsMultiple) { output.Print(", "); value = m_r.GetValue(m_register + 2, Begin - 1); value.Print(output); } } output.Print(" do"); output.PrintLine(); output.IncreaseIndent(); Statement.PrintSequence(output, m_statements); output.DecreaseIndent(); output.Print("end"); }
public override void Print(Output output) { output.Print("for "); m_r.GetTarget(m_register + 3, Begin - 1).Print(output); output.Print(" = "); m_r.GetValue(m_register, Begin - 1).Print(output); output.Print(", "); m_r.GetValue(m_register + 1, Begin - 1).Print(output); var step = m_r.GetValue(m_register + 2, Begin - 1); if (!step.IsInteger || step.AsInteger() != 1) { output.Print(", "); step.Print(output); } output.Print(" do"); output.PrintLine(); output.IncreaseIndent(); Statement.PrintSequence(output, m_statements); output.DecreaseIndent(); output.Print("end"); }
public override Statement Process(Registers r, Block block) { r.SetValue(Register, Line, Value); if (r.IsAssignable(Register, Line)) { return(new Assignment(r.GetTarget(Register, Line), Value)); } else { return(null); } }