ForthVM.Words.Stack (ForthVM v0.5.0) View Source
Stack words
Link to this section Summary
Functions
depth: ( -- x ) get stack depth
drop: ( x -- ) remove element from top of stack
2drop: ( x y -- ) remove two elements from top of stack
dup: ( x -- x x ) duplicate element from top of stack
2dup: ( x y -- x y x y ) duplicate two elements from top of stack
?dup: ( x -- x x ) duplicate element from top of stack if element value is truthly
over: (y x -- y x y) copy second element on top of stack
2over: ( y2 x2 y1 x1 -- y2 x2 y1 x1 y2 x2) swap top copules on top of stack
rot: ( x y z -- y z x ) rotate the top three stack entries, bottom goes on top
-rot: ( x y z -- z x y ) rotate the top three stack entries, top goes on bottom
swap: ( x y -- y x ) swap top two elements on top of stack
2swap: ( y2 x2 y1 x1 -- y1 x1 y2 x2 ) swap top copules on top of stack
Link to this section Functions
depth: ( -- x ) get stack depth
drop: ( x -- ) remove element from top of stack
2drop: ( x y -- ) remove two elements from top of stack
dup: ( x -- x x ) duplicate element from top of stack
2dup: ( x y -- x y x y ) duplicate two elements from top of stack
?dup: ( x -- x x ) duplicate element from top of stack if element value is truthly
over: (y x -- y x y) copy second element on top of stack
2over: ( y2 x2 y1 x1 -- y2 x2 y1 x1 y2 x2) swap top copules on top of stack
rot: ( x y z -- y z x ) rotate the top three stack entries, bottom goes on top
-rot: ( x y z -- z x y ) rotate the top three stack entries, top goes on bottom
swap: ( x y -- y x ) swap top two elements on top of stack
2swap: ( y2 x2 y1 x1 -- y1 x1 y2 x2 ) swap top copules on top of stack