Lately I've been working on a project that involves parsing a toy domain-specific-language. While building it out, I realized that an efficient way to handle parsing tokens would be to represent the parser as a state machine. To great success. Representing each possible state of the parser got rid of many problems I was facing. However, I recently ran into a new issue. Modeling the complete state graph is slowly becoming unmanageable. You can see here that even now the state graph is rather small. It got me thinking, how would one manage the state graph for a large enterprise application?
I'm sure there are 3rd party libraries that do this, but if one was to roll a scalable state machine from scratch how would one do that? Any advice / wisdom would be greatly appreciated here!