aboutsummaryrefslogtreecommitdiff
path: root/ABC/AStack.icl
diff options
context:
space:
mode:
authorCamil Staps2016-07-05 17:25:10 +0200
committerCamil Staps2016-07-05 17:25:10 +0200
commitceb0b74bd0b368124679378ebfb2cf316deb2e39 (patch)
tree7f5c562952bcf0427d838274177123765fe93cf5 /ABC/AStack.icl
parentProgramStore as array for efficiency (diff)
Added Machine as module level
Diffstat (limited to 'ABC/AStack.icl')
-rw-r--r--ABC/AStack.icl42
1 files changed, 0 insertions, 42 deletions
diff --git a/ABC/AStack.icl b/ABC/AStack.icl
deleted file mode 100644
index 0a91ecd..0000000
--- a/ABC/AStack.icl
+++ /dev/null
@@ -1,42 +0,0 @@
-implementation module ABC.AStack
-
-import StdEnv
-
-import ABC.Def
-import ABC.Misc
-
-:: AStack :== [NodeId]
-
-instance toString AStack where toString xs = "[" <++ (",", xs) <+ "]"
-
-as_get :: ASrc AStack -> NodeId
-as_get _ [] = abortn "as_get: index too large"
-as_get 0 [n:_] = n
-as_get i [_:s] = as_get (i-1) s
-
-as_init :: AStack
-as_init = []
-
-as_popn :: NrArgs AStack -> AStack
-as_popn 0 s = s
-as_popn _ [] = abortn "as_popn: popping too many elements"
-as_popn i [_:s] = as_popn (i-1) s
-
-as_push :: NodeId AStack -> AStack
-as_push n s = [n:s]
-
-as_pushn :: [NodeId] AStack -> AStack
-as_pushn is s = is ++ s
-
-as_topn :: NrArgs AStack -> [NodeId]
-as_topn i s = topn [] i s
-where
- topn :: [NodeId] NrArgs AStack -> [NodeId]
- topn ns 0 _ = ns
- topn _ i [] = abortn "as_topn: taking too many elements"
- topn ns i [n:s] = topn (ns ++ [n]) (i-1) s
-
-as_update :: ADst NodeId AStack -> AStack
-as_update 0 n [_:s] = [n:s]
-as_update _ _ [] = abortn "as_update: index too large"
-as_update i n [m:s] = [m:as_update (i-1) n s]