permacomputing

Source repository for the main permacomputing wiki site
git clone http://git.permacomputing.net/repos/permacomputing.git # read-only access
Log | Files | Refs

commit 6140a3c153f2d8ef486f115317640243bbb255da
parent 97a33a102780e1df77a931ca76fd04c42131fab1
Author: neau <neau@web>
Date:   Wed, 22 Jun 2022 00:29:13 +0200

empty web commit

Diffstat:
Astack-based.mdwn | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/stack-based.mdwn b/stack-based.mdwn @@ -0,0 +1,14 @@ +Stack machines are arguably the simplest kind architecture. Their LIFO structure is quite suitable for block-oriented languages. The code size for a stack machine can be very compact because most instructions have no operand field. + +* POP Remove an item at index, closing the hole left in the stack. +* ROLL Remove an item at index, push it on top of the stack. +* PICK Copy an item at index, push it on top of the stack. + +From these primitives, the basic stack operations can be created: + +* DROP a b Discard top item. +* NIP a c Discard second item. +* SWAP a c b Bring second item to top. +* ROT b c a Bring third item to top. +* DUP a b c c Copy top item. +* OVER a b c b Copy second item to top.