simple-stacked-vm-0.1.1: Simple stacked virtual machine: assembler, disassembler, bytecode interpreter

Safe HaskellSafe-Inferred

Language.SSVM.Operations

Synopsis

Documentation

push :: StackType a => a -> VM ()Source

Push value to the stack

pushS :: StackItem -> VM ()Source

Push stack item to the stack

pushD :: StackItem -> VM ()Source

Add item to current definition

pop :: VM ()Source

Drop stack head (a -- )

dup :: VM ()Source

Duplicate stack head (a -- a a)

swap :: VM ()Source

Swap two top items on the stack (a b -- b a)

over :: VM ()Source

(a b -- a b a)

printStack :: VM ()Source

Print stack content

printCurrentDef :: VM ()Source

Print current definition

printF :: VM ()Source

Print stack head (a -- )

variable :: VM ()Source

Define variable

recall :: String -> VM DefinitionSource

Recall word definition

assign :: VM ()Source

Assign value to variable (value variable-number -- )

readVar :: VM ()Source

Read variable value (variable-number -- value)

define :: VM ()Source

Define word

allocArray :: VM ()Source

Allocate an array (size variable-number -- )

readArray :: VM ()Source

Read item from array. (array-or-variable-number index -- value)

assignArray :: VM ()Source

Assign value to array item. (value array-or-variable-number index -- )

goto :: VM ()Source

Get PC from stack (pc -- )

jumpIf :: (Integer -> Bool) -> VM ()Source

Jump to given address if condition is satisfied

mark :: VM ()Source

Mark at current PC ( -- pc)

getMark :: [Marks] -> String -> VM ()Source

Get mark by name ( -- pc)

input :: VM ()Source

Read value from stdin ( -- value)

step :: VM ()Source

Increment PC