public ForBlock(Expression initialValue, List<Instruction> buffer) : base(buffer) { sForCount++; iterator = "_iterator_"+ sForCount; // won't collide with names that are parse-able buffer.Add(new SetInstruction(iterator, initialValue)); branchIndex = buffer.Count; branch = new BranchInstruction( new BinaryOperationExpression( BinaryOperation.GreaterThan, new VariableExpression(iterator), new LiteralExpression(0)), branchIndex+1, -1 ); buffer.Add(branch); }
public WhileBlock(Expression condition, List<Instruction> buffer) : base(buffer) { branchIndex = buffer.Count; branch = new BranchInstruction(condition, branchIndex+1, -1); buffer.Add(branch); }