refactor the lexer and parser