glados-0.1.0.0
Stabilitystable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Compiler.Bytecode.DisasmFinal

Description

This module provides functionality to decode a binary bytecode stream into a human-readable assembly format. It handles the complete instruction set, including variable-length payloads, immediate values, and system operations.

Synopsis

Documentation

disasmFinal :: ByteString -> Either Text [(Int, String)] Source #

Disassemble final bytecode into (offset, pretty-instruction) pairs.

@args - bs: The raw ByteString containing the bytecode (header should be stripped).

@details This function runs the binary parser disasmAll over the input string. It catches parsing errors (e.g., truncated files) and returns a list of tuples containing the byte offset and the string representation of the instruction.

@return Either an error message (Text) or a list of (Offset, InstructionString).