exceptions.py

There is a general base/ parent class for all custom exceptions called InterpreterException which inherits from the in-built Exception class. This class is an abstract class cannot be instantiated on its own, you need to instantiate one of it's many subclasses.

The InterpreterException class takes in a message that will be displayed to the user upon encountering the exception, it can also take in three optional keyword arguments: label_that_crashed, instruction_that_crashed and exit_code.

Interpreter Exceptions

NameDescriptionExample
InterpreterSyntaxErrorwhen a syntax error is encountered in the assembly codean empty label or out of place label
InterpreterProcessErrorwhen functions are called out of the expected orderthe Interpreter is run before the labels and memory is mapped
InterpreterRegisterErrorwhen an invalid register is usedsome value is set to register $t55
InterpreterControlFlowErrorwhen an unexpected control flow event occursthe code has reached someplace it shouldn't, processing a jump instruction from the Multiplexer
InterpreterValueError
InterpreterConversionErroran invalid conversion took place
InterpreterRuntimeErrora general runtime exception
InterpreterInstructionErroran instruction is encountered that is not validan invalid instruction xyz is encountered