Interface IExecutionEngine

All Known Implementing Classes:
ProgramExecutionEngine

public interface IExecutionEngine
Engine responsible for an instruction execution within its execution context. If any method provided by this interface throws an exception, entire execution context should be considered invalid unless explicitly specified by the implementation.
Author:
Erik Zemčík
  • Method Details

    • jumpToLabel

      void jumpToLabel(String label)
      Performs a jump to an instruction that is followed by the specified label. This label must be known by the engine or an exception is thrown.
      Parameters:
      label - label to jump to
      Throws:
      IllegalArgumentException - if label is null or empty
      UnknownJumpLabelException - if label is not known by the engine
    • getNextInstructionDescriptor

      Optional<InstructionDescriptor> getNextInstructionDescriptor()
      Returns a descriptor of the instruction that will be executed next by the engine.

      This method returns an empty Optional if the engine has no next instruction or if the retrieval is not supported by the implementation.

      Returns:
      instruction descriptor of the next instruction or an empty Optional
    • step

      void step()
      Executes a single instruction on the engine's execution context and moves to the next.
      Throws:
      NoNextInstructionException - if engine has no next instruction available
      StepExecutionException - if execution of the instruction fails