Home

Awesome

Kairos

A Java-based interpreter for Whitespace and WhitespaceAssembler

Part 1: WhitespaceAssembler command overview

Stack operations

OperationBreakdownAliases
'push X'push value X onto stack#X
'dupl'duplicate value on top of stackduplicate, dupe, cc
'copy X'copy X-th value onto stackcp X
'swap'swap top two items of stacksw
'pop'discard top item from stackp
'slide X'discard X items after top item from stacksl X

Arithmetic operations (Note: Removes top two values from stack, places result of operation on top.)

OperationBreakdownAliases
'add'add top two items+
'sub'subtract top item from second to top itemsubtract, -
'mul'multiply top two itemsmultiply, *
'div'divide second to top item by top itemdivide, /
'mod'modulo compute remainder of the division operation of top two itemsmodulo, %

Heap operations (Note: Requires address on top of stack, and a value on top of that in case of 'store'. Consumes both, if applicable; places retrieved value on top of stack in case of 'get'.)

OperationBreakdownAliases
'store X'store value X in heap@X
'get'get value from heap?

Flow control operations

OperationBreakdownAliases
'label X'create label X at this point:X
'call X'call subroutine XX()
'jump X'jump to label Xgo to X, goto X, => X
'jzero X'jump to label X if top item on stack is zero0=> X
'jneg X'jump to label X if top item on stack is negative-=> X
'ret'return from subroutinereturn
'exit'exit program

Input/Output operations

OperationBreakdownAliases
'printc'print characterpc
'printn'print numberpn
'readc'read characterrc
'readn'read numberrn

Meta operations (Note: These are not part of the Whitespace specification; they currently can only be resolved by the Kairos interpreter and will be lost in translation to Whitespace proper.)

OperationBreakdownAliases
'import X'import WhitespaceAssembler function X into current code; duplicate imports have no effectrequire