Sequencing Next: Parallelism Up: Basic InstructionsPrevious: NothingStop, and Suspend

Sequencing

Seq  extends BinaryInstruction and implements sequencing. First the left instruction is activated; if it terminates the control goes to the right instruction.

 
public class Seq extends BinaryInstruction
{
  public Seq(Instruction left, Instruction right)
  {
     super.left = left;
     super.right = right;
  }

  final public String toString(){ return left + "; " + right; }

  final protected byte activation(Machine machine)
  {
     if (left.isTerminated()) return right.activ(machine);
     byte res = left.activ(machine);
     if (res != TERM) return res;
     return right.activ(machine);
  }
}