I need to build a simple parser for a input type expressed as text.
I have implemented a FSM in Java using two int arrays:
states[][]
actions[][]
As I was debugging it I realized that it might be easier to use Java Enums as a variable of those types should show up as the value in the debug view in IntelliJ. However, when I started down this path it seemed that the only way to use Enums is to put the state and action tables in a HashMap - or is there a way to make a multi-dimensional array where the dimensions are Enum values? I'd prefer to not take the object creation and performance hit entailed with a HashMap if I can help it.
I was then thinking I might look at Scala to see if it might be a better option.
So, the question is - would Scala be a better language for expressing a tight FSM or am I better off sticking with Java int arrays?