POC: basic parser state machine