def runProgram(state: programState.ProgramState, fileName: str, lines: List[str]) -> programState.ProgramState: while True: state, res = executeInstruction( state.getInstructionFromMem(state.getReg("PC")), state, fileName, lines) if not res: break return state
def generateStacktraceElement(state: programState.ProgramState, address: int, fileName: str, lines: List[str]) -> str: instr: nodes.InstructionNode = state.getInstructionFromMem(address) if isinstance(instr, nodes.SystemCall): return f"\tInternal function: {instr.name}" return f"\tFile \"{fileName}\", line {instr.line}:\n\t\t{lines[instr.line-1].strip()}"