From 4637682209541f02ca68fc6c430254c1a6eb7833 Mon Sep 17 00:00:00 2001 From: Ashley Sanders Date: Tue, 30 Jan 2018 12:33:54 -0500 Subject: [PATCH] Added Instruction datatype and i2s (Instruction to string) function. --- Homework_1.sml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Homework_1.sml b/Homework_1.sml index 314c138..bf08a19 100644 --- a/Homework_1.sml +++ b/Homework_1.sml @@ -10,3 +10,11 @@ fun getA (m : MachineState) = #a m; fun getB (m : MachineState) = #b m; fun setA (m : MachineState, newA) = newMachine(newA, #b m); fun setB (m : MachineState, newB) = newMachine(#a m, newB); + +(*Instruction Set*) +datatype Instruction = SetA of int | SetB of int | Add | Sub | Disp; +fun i2s (SetA a) = "SetA " ^ Int.toString(a) + | i2s (SetB b) = "SetB " ^ Int.toString(b) + | i2s Add = "Add" + | i2s Sub = "Sub" + | i2s Disp = "Disp";