Skip to content

Commit

Permalink
Created registers with a MachineState record. Includes getters and se…
Browse files Browse the repository at this point in the history
…tters for each variable (a and b).
  • Loading branch information
ars13025 committed Jan 30, 2018
1 parent 57ea40a commit 83bfdb5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Homework_1.sml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
(*
Homework 1
Homework 1: Simple Register Machine
By: Ashley Sanders
*)
type MachineState = {a:int, b:int};
fun newMachine (a, b) : MachineState = {a=a, b=b};

(*Getters and Setters*)
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);

0 comments on commit 83bfdb5

Please sign in to comment.