use AST to traverse