rewrite parser with better structure and more syntax control