rewrite lexer and parser
fix pair bug