data MRef | MRefI Int | MRefId String deriving MRef : Eq, Show data Cond | CLET | CLT | CGET | CGT | CE | CNE deriving Cond: Eq, Show type Equ = (String,Int) type Equates = [Equ] type Labels = [String] data Stmt | Stmt labels :: Labels instr :: Instr deriving Stmt: Eq, Show type Stmts = [Stmt] data Prog | Prg stms :: Stmts equates :: Equates deriving Prog : Eq, Show data Instr | IMMI dest :: MRef Int -- Move a int into memory | IMMS dest :: MRef String -- Move a string into memory | IMRPC dest :: MRef Int -- Move a relative PC into memory | SPC oper :: MRef -- Set PC from memory | IMMM dest,oper :: MRef -- Move Memory to Memory | IAdd dest,left,right :: MRef -- Add two Memory References | ISub dest,left,right :: MRef -- Sub two Memory References | IMul dest,left,right :: MRef -- Mul two Memory References | IDiv dest,left,right :: MRef -- Div two Memory References | IMod dest,left,right :: MRef -- Mod two Memory References | IMRI dest,oper :: MRef Int -- Move to Memory Ref | IMMR dest :: MRef Int oper :: MRef -- Move to Memory Ref | IRI oper :: MRef -- Read an Int into a Mem Ref | IWI oper :: MRef -- Write an Int from a Mem Ref | IRS left, right :: MRef -- Read a Str | IWS oper :: MRef -- Write a Str | IGI Int -- Goto to line | IGS String -- Goto sym | IFI bcond :: MRef cond :: Cond then :: MRef Int -- If Cond then Int | IFS bcond :: MRef cond :: Cond then :: MRef String -- | IH -- Halt | IB -- Break | INI deriving Instr : Eq, Show