aboutsummaryrefslogtreecommitdiff
path: root/ABC/Machine/Program.icl
blob: 5b4e822880cdacb90f63d5c19d7c69461d43a305 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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}