glados-0.1.0.0
Stabilitystable
Safe HaskellNone
LanguageHaskell2010

VM.Instruction.System

Description

 
Synopsis

Documentation

instPrint :: VirtualMachine () Source #

Implements PRINT (Opcode 0x70).

@details Pops the top value from the stack and prints its string representation to the standard output (stdout), followed by a newline. Useful for debugging or simple output programs.

instHalt :: VirtualMachine () Source #

Implements HALT (Opcode 0x71).

@details Sets the isRunning flag of the VM state to False. This will cause the main Execution loop to terminate gracefully on the next cycle.

instExit :: VirtualMachine () Source #

Implements EXIT (Opcode 0x72).

@details Pops an integer status code from the stack and terminates the process. Useful for unit testing (exit 84 on failure).

instCheckStack :: VirtualMachine () Source #

Implements CHECK_STACK (Opcode 0xFE).

@details Ensures the stack has at least N elements. Reads N as an Int32. Throws error if stack is too small.