Rough cut of a naive regex-based parser