Recently, I was working on a Finite State Machine library in C for a couple of complex parsing tasks. Trying to come up with examples, I decided that a URI parser (following the standardized URI format found in RFC 3986) would be a good test, as well as an easy test for other people to try out. Try entering a URI below, and see what happens!
All of the FSM code as well as the different examples (uri parsing, date parsing, etc) are all available at the GitHub project page. Below, you can test the URI parser and take a look at the output. If you notice a bug, please, leave a comment!
This code is memory-leak free (tested via valgrind). I haven’t licensed it yet, so send me an email if you want to use any piece of my FSM project in your own code.