Parser gen

Replace regexes with parser generator.