ForthVM.Words.Stack (ForthVM v0.5.0) View Source

Stack words

Link to this section Summary

Functions

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

Link to this function

depth(tokens, data_stack, return_stack, dictionary, meta)

View Source

depth: ( -- x ) get stack depth

Link to this function

drop(tokens, list, return_stack, dictionary, meta)

View Source

drop: ( x -- ) remove element from top of stack

Link to this function

drop2(tokens, list, return_stack, dictionary, meta)

View Source

2drop: ( x y -- ) remove two elements from top of stack

Link to this function

dup(tokens, list, return_stack, dictionary, meta)

View Source

dup: ( x -- x x ) duplicate element from top of stack

Link to this function

dup2(tokens, list, return_stack, dictionary, meta)

View Source

2dup: ( x y -- x y x y ) duplicate two elements from top of stack

Link to this function

dup?(tokens, data_stack, return_stack, dictionary, meta)

View Source

?dup: ( x -- x x ) duplicate element from top of stack if element value is truthly

Link to this function

over(tokens, list, return_stack, dictionary, meta)

View Source

over: (y x -- y x y) copy second element on top of stack

Link to this function

over2(tokens, list, return_stack, dictionary, meta)

View Source

2over: ( y2 x2 y1 x1 -- y2 x2 y1 x1 y2 x2) swap top copules on top of stack

Link to this function

rot(tokens, list, return_stack, dictionary, meta)

View Source

rot: ( x y z -- y z x ) rotate the top three stack entries, bottom goes on top

Link to this function

rot_neg(tokens, list, return_stack, dictionary, meta)

View Source

-rot: ( x y z -- z x y ) rotate the top three stack entries, top goes on bottom

Link to this function

swap(tokens, list, return_stack, dictionary, meta)

View Source

swap: ( x y -- y x ) swap top two elements on top of stack

Link to this function

swap2(tokens, list, return_stack, dictionary, meta)

View Source

2swap: ( y2 x2 y1 x1 -- y1 x1 y2 x2 ) swap top copules on top of stack