rewrite lexer and parser