compile static method

List<Instruction> compile(
  1. List<TurtleCommand> commands
)

Compiles commands to instructions.

Implementation

static List<Instruction> compile(List<TurtleCommand> commands) {
  var turtle = TurtleState();
  var argv = {};
  var instructions = <Instruction>[];
  try {
    for (var command in commands) {
      instructions.addAll(command.createInstruction(turtle, argv));
    }
  } on StopException catch (_) {}
  return instructions;
}