aboutsummaryrefslogtreecommitdiff
path: root/ABC/Machine/Program.icl
diff options
context:
space:
mode:
Diffstat (limited to 'ABC/Machine/Program.icl')
-rw-r--r--ABC/Machine/Program.icl27
1 files changed, 27 insertions, 0 deletions
diff --git a/ABC/Machine/Program.icl b/ABC/Machine/Program.icl
new file mode 100644
index 0000000..5b4e822
--- /dev/null
+++ b/ABC/Machine/Program.icl
@@ -0,0 +1,27 @@
+implementation module ABC.Machine.Program
+
+import StdEnv
+
+import ABC.Machine
+import ABC.Misc
+
+pc_init :: InstrId
+pc_init = 0
+
+pc_next :: InstrId -> InstrId
+pc_next i = i + 1
+
+pc_halt :: InstrId -> InstrId
+pc_halt _ = -1
+
+pc_end :: InstrId -> Bool
+pc_end i = i < 0
+
+:: Location = I Instruction
+:: ProgramStore :== {Location}
+
+ps_get :: InstrId ProgramStore -> Instruction
+ps_get n p = let (I i) = p.[n] in i
+
+ps_init :: [Instruction] -> ProgramStore
+ps_init is = {I i \\ i <- is}