summaryrefslogtreecommitdiff
path: root/stack/src/stack.ads
diff options
context:
space:
mode:
Diffstat (limited to 'stack/src/stack.ads')
-rw-r--r--stack/src/stack.ads26
1 files changed, 26 insertions, 0 deletions
diff --git a/stack/src/stack.ads b/stack/src/stack.ads
new file mode 100644
index 0000000..4f390e3
--- /dev/null
+++ b/stack/src/stack.ads
@@ -0,0 +1,26 @@
1generic
2 type T is private;
3package Stack is
4 type Stack is private;
5
6 -- Push a value into the stack.
7 procedure Push (S : in out Stack; Val : T);
8
9 -- Pop a value from the stack.
10 function Pop (S : in out Stack; Val : out T) return Boolean;
11
12 -- Return true if the stack is empty, false otherwise.
13 function Empty (S : Stack) return Boolean;
14private
15 type Node;
16 type Node_Access is access Node;
17
18 type Node is record
19 Val : T;
20 Bottom : Node_Access;
21 end record;
22
23 type Stack is record
24 Top : Node_Access;
25 end record;
26end Stack;