implement regex lex parser.