| 1 |
@* The stack operations the calculator and the concatenative language share. *@ |
| 2 |
|
| 3 |
<StackOp Name="dup" Description="Duplicates the top value on the stack"> |
| 4 |
<StackStep Stack="[1, 2, 3]" Program="dup"/> |
| 5 |
<StackStep Stack="[1, 1, 2, 3]"/> |
| 6 |
</StackOp> |
| 7 |
|
| 8 |
<StackOp Name="drop" Description="Drops the top value on the stack"> |
| 9 |
<StackStep Stack="[1, 2, 3]" Program="drop"/> |
| 10 |
<StackStep Stack="[2, 3]"/> |
| 11 |
</StackOp> |
| 12 |
|
| 13 |
<StackOp Name="swap" Description="Swaps the top two values on the stack"> |
| 14 |
<StackStep Stack="[1, 2, 3]" Program="swap"/> |
| 15 |
<StackStep Stack="[2, 1, 3]"/> |
| 16 |
</StackOp> |