Project

General

Profile

Scol stack » History » Version 1

arkeon, 04/29/2011 07:24 PM

1 1 arkeon
h1. Scol stack
2 1 arkeon
3 1 arkeon
Scol virtual machine operates on the principle of a data stack, the elements are pushed or pulled into an order defined by the function. The stack status is very important, an element in the wrong place can make the stack unstable throughout the system.
4 1 arkeon
5 1 arkeon
h2. Representation of the Scol stack
6 1 arkeon
7 1 arkeon
The Scol stack can be represented as follows:
8 1 arkeon
* Pull (MMpull) an element of the stack returns to remove this item from the stack, the order of the indexes of elements remaining in the stack is changed.
9 1 arkeon
<pre>
10 1 arkeon
   [_2_]
11 1 arkeon
   [_1_]
12 1 arkeon
   [_0_]
13 1 arkeon
      [___] -> pull
14 1 arkeon
</pre>
15 1 arkeon
16 1 arkeon
* Push (MMpush) an element in the stack returns to add this item to the stack. The order of the indexes of elements in the stack is changed, the new element is at index 0.
17 1 arkeon
<pre>
18 1 arkeon
          [_3_]
19 1 arkeon
          [_2_]
20 1 arkeon
          [_1_]
21 1 arkeon
 push -> [_0_]
22 1 arkeon
</pre>
23 1 arkeon
24 1 arkeon
h2. References
25 1 arkeon
"Data structure":http://en.wikipedia.org/wiki/Stack_(data_structure)