a very simple, state machine based parser