reimplement the parser to use regexp