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 Summary
Modifier and TypeMethodDescriptionReturns a descriptor of the instruction that will be executed next by the engine.voidjumpToLabel(String label) Performs a jump to an instruction that is followed by the specifiedlabel.voidstep()Executes a single instruction on the engine'sexecution contextand moves to the next.
-
Method Details
-
jumpToLabel
Performs a jump to an instruction that is followed by the specifiedlabel. This label must be known by the engine or an exception is thrown.- Parameters:
label- label to jump to- Throws:
IllegalArgumentException- iflabelisnullor emptyUnknownJumpLabelException- iflabelis 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
Optionalif 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'sexecution contextand moves to the next.- Throws:
NoNextInstructionException- if engine has no next instruction availableStepExecutionException- if execution of the instruction fails
-