added AstVisitor for AST

implements visitor pattern