ugly attempt to implement recursive-descent parsing. Would be so easy and clean if we could use references.