Mealy Machine Exercises
-
Specify, design, and implement a general representation for aMealy Machine as a set of Scala definitions implementing anabstract data type. It should hide the representation of themachine behind an abstract interface and should have, at least, thefollowing public operations.
-
Constructor MealyMachine(s) creates a new machine with initial(and current) state s and no transitions.
-
Mutator method addState(s) adds a new state s to this machineand returns an Either wrapping the modified machine or an errormessage.
-
Mutator method addTransition(s1,in,out,s2) adds a new transitionto this machine and returns an Either wrapping the modified machineor an error message. From state s1 with input in,
OROR
-