Implement the lexer with regexes